Despite the growth of online shopping, there’s still something about going into a physical store location and having a tactile interaction with products. It’s always good to try on clothing or get a feel for a new device or tool before bringing it home.

Retail therapy, however, seems to grind to a halt when the cashier starts to ring you up and then asks for your ZIP code. It’s a peculiar query that doesn’t seem relevant to buying socks. And unlike soliciting your email address, it doesn’t seem like it’s terribly useful information to make you a repeat customer. So why do stores do it?

Call it a subversive form of marketing. When a store has both your name—usually from the credit card you’re probably using—and your ZIP code, they’re able to retrieve more of your personal information, like your mailing address, phone number, or records of past purchases. (The data comes via data brokers, who can use your name and ZIP to dig up more identifying information.)

Asking for your ZIP is, essentially, like asking for your home address. Stores can then send junk mail. Worse, they can profit by selling that information to third parties, who divert more flyers and sales notices your way.

Sometimes, retailers can frame the request as being mandatory to complete a transaction. Urban Outfitters got into a legal tussle for exactly that in Massachusetts, with a court ruling that ZIP codes were personal information shielded by consumer protection laws. The retailer settled in 2015 for $731,180 in the form of gift cards to the aggrieved parties. Craft store Michaels and OfficeMax have faced similar complaints.

But ZIP code collection isn’t always for the purpose of cramming your mailbox full of unwanted sales notices. By tracking sales tied to locations, stores can assess which products are selling in a given area, which may ultimately benefit the consumer in the form of better stock or more varied selection. And some credit cards, like American Express, prompt retailers to ask for a ZIP code as a form of fraud protection.

If you’re paying with cash, giving a cashier your ZIP code isn’t going to result in any unwanted advertising—they’d still need your name for that. But if you’re paying with a card and want to maintain some degree of privacy, you can simply decline to share it.

There is one exception to this ZIP code cat-and-mouse game—gas stations. When you go to fill up, the pump will usually prompt you for your ZIP. This typically isn’t to gather data but to deter credit card theft, as thieves like to test whether a stolen card is working by performing an automated transaction and avoiding a face-to-face interaction.

[h/t The New York Times]