For example, you couldn't do this in Massachusetts. A city would first have to petition the state for a new law allowing the city to pass such a local law.
However, in this case it’s because NYC law is typically allowed under NY state law to be stronger (but not weaker) than any corresponding state law.
how: by declaring it a law in that area
Course, one should never underestimate the value of a benevolent dictator...
For example, you couldn't do this in Massachusetts. A city would first have to petition the state for a new law allowing the city to pass such a local law.