Because Amazon benefits from massive economies of scale, and because Amazon has nearly-unlimited cash to push competition out of the market?
How could a regular webshop possibly compete with a behemoth which has warehouses in literally every major city, which has its own dedicated fleet of delivery vehicles, and which has its own fleet of cargo planes? When you've got a single warehouse and have to rely on DHL/USPS/FedEx, you will never beat them on delivery time when Amazon is actually trying: Amazon can trivially offer same-day delivery and eat the cost until you go out of business.
And don't forget: Amazon has an even bigger margin. If they were to compete on price, they would easily win. But they aren't competing on price because they know they have a quasi-monopoly, so they can just enjoy the extra profit.
It is surprising how often they are cheaper. I was ordering some glue, decided to double check the price, I could drive for 30 minutes and buy local, and pay more or order it for cheaper from Amazon. I didn't need it the same day so getting it tomorrow didn't matter. Amazon also sells everything need some M2 screws Amazon will have them, no idea where to buy something like that locally Home Depot won't carry them.
I often think about how there's an open question in this case of whether it's necessarily anti-social for a market participant to fight hard to create the level of critical mass necessary to give most people the product they want.
Everyone likes stuff showing up at their door reliably wherever they are, and this isn't possible unless you have a service with warehouses and dense customers ~everywhere, and this isn't possible unless enough people use that same service. So in one sense it's in everyone's interest to have an assurance contract where everyone says "I will use this service if you do." Then in that sense Amazon's price rule is building a mechanism to support such an assurance contract: you can't force people to sign such a contract, but you can prevent people from defecting to slightly lower prices outside of the "stuff just arrives fast" system.
In a system that was very good at collective action outside of markets, a cleaner solution in terms of consent and power might be to build an actual explicit assurance contract for an app-to-door-everything-delivered-fast service, get everyone to sign it, and make a public utility and/or separate dis-aggregated markets for the different levels of service provision, whatever they are (consumer facing app, supply, warehouse, delivery, etc.). But anyone who has ever even thought about doing anything like this will know that it's much easier said than done, and will appreciate the kludge Amazon and their investors pulled off, at least a little bit, the next time they buy a thing online.
Maybe the answer is just: use Amazon until technology (robotics e.g.) makes it easy to create something better? At this rate, we shouldn't have to wait too long?