In most US states local municipalities can only pass ordinances or laws with state permission. From Wikipedia:
In the United States, home rule refers to the authority of a constituent part of a U.S. state to exercise powers of governance delegated to it by its state government. In some states, known as home rule states, the state’s constitution grants municipalities and/or counties the ability to pass laws to govern themselves as they see fit (so long as they obey the state and federal constitutions). In other states, only limited authority has been granted to local governments by passage of statutes in the state legislature. In these states, a city or county must obtain permission from the state legislature if it wishes to pass a law or ordinance which is not specifically permitted under existing state legislation.
Forty of the fifty states apply the principle known as Dillon’s Rule in some form to determine the bounds of a municipal government’s legal authority. The National League of Cities identifies 31 Dillon’s Rule states, 10 home rule states, 8 states that apply Dillon’s Rule only to certain municipalities, and one state (Florida) that applies home rule to everything except taxation. Each state defines for itself what powers it will grant to local governments.