Like if you walk into a store and they offer you coffee or even a glass of prosecco, I would also say to my wife "oh we're in that kind of store now" because you know you're about to be ripped off in some way. Not that other stores are for weaklings.
It's kind of similar to the Whole Wheat Bakery asking you whether you're OK with gluten. If you aren't, you made a big mistake walking in.
Affluent areas in general have more variety. The ice cream shop may be a place where you can get all kinds of ingredients that you wouldn't find at other places. This is 100% true for "fine dining" and it's one reason why they ask.
They will also have substitutes for an allergy to make the experience just as pleasant, thus they ask.
> Affluent areas in general have more variety.
No, it's definitely a difference in cultural norms, not something driven by the store inventory.
> They will also have substitutes for an allergy to make the experience just as pleasant
This is not the case for dairy in an ice cream shop, or for wheat in a "whole wheat bakery".
It's just a completely ridiculous thing to check. Like warning that the boiled peanuts contain peanuts, or that a pencil sharpener should not have fingers inserted into it.