Buying a stock is not lending money to a company. It's purchasing an ownership claim on future earnings realized by the company.
For AMZN, the expectation of its investors is that it should not realize substantial (relative to revenue) earnings now so that it can grow further and thereby increase the long-tail earnings to which shareholders are entitled.
GOOG, on the other hand, is returning money to shareholders now. In fact, they just authorized a program to return another $50B to shareholders. Our tax regime skews payout preferences, so that instead of paying dividends, some companies opt for share buybacks. But the net result is that cash is transferred from the company to its shareholders. You can see GOOGL's buybacks over time here, looks like they returned ~$31 billion to shareholders in 2020: https://ycharts.com/companies/GOOG/stock_buyback .