Well that's the key. Go somewhere without that problem in the US, and every amenity is easy to find. In some places, you can visit a stranger's house and ask to use the toilet, which I've seen before.
In Italy all the public business like coffee shops ("bars") have to let free access to the toilet by law, even if you don't buy anything.
McDonald's and Starbucks etc. will have no problem figuring out how to qualify for the tax break and jump through the hoops to get it. Then the city gets hundreds of new public bathrooms that they don't have to maintain for minimal cost.
A small mom and pop bodega or flower shop or whatever that barely makes a profit might decide it's not worth it. If it's a requirement, that business just ceases to exist and the city is deprived of it. If it's optional, they can still operate, and the city doesn't end up a homogeneous wasteland of corporate brands. They just don't get a tax break, but if they're not making much money, they probably aren't paying much tax anyway.
I live in Hong Kong and am still a little amazed at the ubiquitous, free, clean public restrooms. They're not luxurious usually, but they're available and never a disaster. As far as I can tell, the city employs a pretty large staff to check and clean them throughout the day. But then there's also no massive homeless and drug problem like there is in the US.