The federal reserve addresses state/local laws:
>Private businesses are free to develop their own policies on whether to accept cash unless there is a state law that says otherwise.
These laws are new and only exist in a few locales.
The laws are new because the practice they react against is, generally speaking, a recent problem.