And the buyer tries to pay as little as possible. Negotiating is a skill well worth learning (lots of books on it).
This discussion is perverse. Negotiations require leverage, which the average grocery buyer in the USA does not have. As a society we don't benefit from min-maxing absolutely every opportunity.
The buyer in a grocery store can't negotiate; the store just sets the price and the buyer's only choice is to take it or leave it. Under the conditions described, the product is still worth it to the buyer who the store is charging the higher price (the one the store knows has more income and so can afford to pay more), at the higher price--there's just less consumer surplus. So the buyer still buys the product. But there's no negotiation anywhere; there's no opportunity for it.