One reason it works this way is that treating displayed items as an offer to sell would leave it unclear to whom the offer to sell would be made. Clearly each item on display can only be sold to one of the many shoppers who sees it, so they can't all be offered the sale. There are several other reasons too, like different customers being offered different terms of sale based on loyalty program membership, promotions, student or senior discounts, etc.
Here is the Wikipedia summary: https://en.wikipedia.org/wiki/Invitation_to_treat
As the article says, the term in various US jurisdictions may be slightly different, like invitation to bargain, but the basic concept is the same. (I'm ignoring Louisiana entirely, which has a completely different legal tradition not derived from English common law.)