I think local government in Spain has at least as much authority as it does in the UK, maybe more, but almost certainly less than it does in the US.
Regardless, cities do not have their own "local laws" in the way your comment made it seem. We have national laws, and minor differences in various autonomous communities, since they have some legislative power to control their own industry, commerce, education and some more stuff.
Corps and cities are very similarly structured. Each are charted at the start, with corps getting governed by boards and c-suite types while cities have mayors and city council types. Both file paperwork to exist within the state. Both are subject to state laws, but are allowed to make up regulations specific to them as long as they are within the state's laws.
In the end, it's all just paperwork, at least in the US
I suspect that this should be qualified by "in the US"