This is actually a great example, but not the way you intended it.
Amazon isn't beating Walmart. They haven't even dented Walmart's revenue[1]. They're just killing everyone other than Walmart.
Walmart is now unbeatable because they're so big, they can demand wholesale prices that no one else can. If Walmart wants to buy 100M tomatoes from you, you'd sell them barely above cost because otherwise you're stuck with more tomatoes than you could ever sell.
To put it another way: you can't compete with these companies because they abuse their market power (either directly or through regulatory capture), not because they're actually that good at anything.