While not a federal, or even state issue it is very much a locality issue. One which is unique to a given locality and is well within their rights to legislate.
It's for the same reason right to farm laws exist, no community wants to give up its right of self direction to outsiders. Even if in many ways it's not to benifit of its neighbors.