It benefits stores to have restrooms for their customers because if you’re shopping and have to go to the bathroom and there’s no restroom available, what are you going to do? You’re going to leave, possibly without buying anything or maybe by buying less. That’s why some stores sell food and/or drinks (for example, IKEA or large dept stores), because if you’re hungry, you may leave. Satiate that hunger and now, ready for round 2 of shopping.
If restaurants and coffee shops allowed non-paying guests to sit and eat, not only would it take up table space from paying customers, but it would more quickly fill up garbage pails as the non-payers would be disposing of their brown bags, plastic utensils and cups and bottles in the garbage pails of the restaurants. In a city like NYC, with thousands of workers looking for places to eat, in the winter, if restaurants allowed “open season” on coming and using their tables (the equivalent of a cafeteria), there definitely would be no room for paying customers. In NYC in the warm weather, the thousands of workers are in parks and on public benches eating lunch. In cold weather, those workers are going to look for indoor seats. If I were a restaurant owner, I would not want them all coming in to take up my valuable table space (especially because I’d be paying high rent for my location and getting nothing back from these non-paying guests).
If I had to use a restroom and were turned away when asking, I might explain that I had to go so badly that I may pee on the floor. Hopefully that would be an incentive for the store or restaurant worker to let me go.