They’re not uncommon but in my experience you tend to find them more in tourist areas with high foot traffic or if there are a lot of homeless people or something along those lines.
If you're a well groomed adult and walk up to the counter at a coffee shop and ask for the code, they'll usually just give it to you no questions asked.
The selective enforcement is the point, because they use these policies to keep away the "types" of people they don't want in the businesses (i.e. unhoused people, teens, etc).