That isn’t actually true. The price on the shelf is considered to be an invitation to treat. By taking the item to the checkout you are offering to buy it which they can reject. In practice they will sell it to you for the price on the shelf but this is not the law
This reminds me of how Eeyore is treated in Winnie the Pooh