If I need to use a restroom, I usually try to buy something, even a pack of gum. But as I get older...when the bladder comes-a-knocking...I am not beyond going in and making a beeline to the head. And then I even buy something on the way out.
But I have no problem with any place specifying that you don’t occupy space unless you are a customer. And while it is true there are some places that would have no issue with non-customers milling around, I have seen from personal experience there are some places that have to actively discourage it because the courtesy is abused by people...especially in busy places.
I’m on the road for work a lot. I’d get fat if I bought something every gas station I stopped at.
Starbucks, Panera and McDonald’s proclaim themselves as a de-facto community center. That includes the bathroom’s.