CVS, El Pollo Loco to name 2 that I've interacted with lately. When you buy something there, they give you coupons at the register for next time that are pretty deep. I'm guessing this is a proven effective marketing technique judging by the big companies using it.
So for a restaurant for example the coupon can be customized based on the age, gender, how many in the party and what they already ordered. The value of the coupons could be even computed in realtime, based on supply and demand + some safety rules built in. Everyone at a different times could get a different coupon for a different value.
Most of the supermarkets round here do it, whether in tokens (40% off your next milk purchase!) or points-based loyalty cards which can be exchanged for gifts when you've collected enough.
The coupons that you're talking about are for specific products. The idea being that you come in to get that price on one thing, and wind up picking up others at full price.
Some stores offer coupons for your next purchase. For example, Gap gave me coupon for 20% off any one item if I complete their online survey. That's a pretty big discount, so that survey information must be pretty valuable.
I think that they don't expect you to come back for just 1 item. So I would guess that they value the engagement and increased chance of a trip to a store.
I don't know their margins, but I doubt a 20% discount has them losing much on that item.