I think where the analogy falls apart isn't whether or not there may be expired products on the shelves, it's whether or not the store will make a reasonable effort to make it right and either refund your money or replace the product with one that's known to be good. Most will.
Source: I ditched the techpocalypse at the end of 2024 and now happily work at a grocery store.
They… will not say that, because they get a large fine if you report them. Every store I've been too has been deeply apologetic when this has happened (a small handful of times in my entire life).
In a lot of the US it is entirely legal to sell expired food. Near me there are grocery stores that specialize in “close to expiration” food, for a discount.
Rewe in germany also has some things discounted when close to expiration as well, but it has a fat red/white label on it indicating it (usually meat products)