You could drive all over town buying groceries piecemeal at whatever store has the biggest loss leader deal on those particular items, but for a loaf of bread and a gallon of milk and a dozen eggs the savings will be offset by the expense of going to multiple stores. Yet if you are buying 10,000 gallons of milk and 10,000 loaves of bread, it becomes feasible.
It's cultural and it started way before they reached any scale. Bezos famously refused to buy desks and used recycled doors because it was cheaper. This isn't specific to Amazon, pretty much any business involved in distribution will work on ultra thin margins. If they don't penny pinch then they don't survive.
Incidentally this is most of what makes these places so miserable for their employees. They will think about their employees the same way they might consider an order for a million rolls of toilet paper.
Because mafia has done that and more
"optimizing for the short term over the long one"
A good way to optimise for short term is to become a drug dealer.