I've seen posts on Reddit[1] that say that cashless establishments in NYC will just give you your food for free if you try to pay with cash. Never tried it though.
[1]https://www.reddit.com/r/nyc/comments/vcebns/im_an_ex_employ...
[1]https://www.reddit.com/r/nyc/comments/vcebns/im_an_ex_employ...
This would not apply in a shop of course as they could just refuse to sell you the goods.
In the US at least.