It's not that Amazon is giving its money to customers. Bezos is very cleverly taking advantage of a loophole in how taxes/accounting works. Over long periods of time, cash flow and income will generally converge. But in the short term, they don't have to. Bezos runs the business around cash flow while minimizing income. Corporate taxes are based on income. The reason for that is because the tax code wants to make sure a business actually has the cash to pay taxes, before owing them. Straightforward enough.
As Bezos bluntly states publicly, he focuses on free cash flow. That number is going through the roof, and while portions of it go into lower prices, a lot more of it goes into investments in new products/infrastructure that will further grow cash flow while effectively deferring net income. That balance is extremely difficult to manage, and Bezos is probably the best the world has ever seen. All that said, it's not quite right to say that they're donating profits to consumers.