Not necessarily selling below cost. They can save money in all sorts of ways:
- charging brands to put their products in the best shelves
- fridges and shelves with ads and product names (often provided for free by the brands)
- bigger sales volume reduce cost of storage, reduce amount of expired products and as you said, also guarantee a better price when acquiring the goods.
- they have much more data on what sells at what price
- they know very well what kind of products people will check the price for and which ones they'll just buy in whatever store they are already at (so they put a lower price on product X to get people in the store and then a higher price on product Y to cover for it)
- they own multiple store brands, with different price ranges, so they can make one store generate profit for both of them similarly to the previous point.
- they do all sorts of sketchy stuff to get tax breaks, insurance claims and other stuff that may have give them some money back
- they may sometimes move products between stores to sell everything that might be expiring soon
- they have their own product brands that they can save money on
- in some places they may re-package stuff to artificially extend their shelf life.
- probably a lot more stuff I never even considered.