Cities in the US can pass laws. They're called local ordinances: https://en.wikipedia.org/wiki/Local_ordinance#United_States
And the mayor just writes them?
And the mayor just writes them?