If the companies have no profits, and investors get no return.
..why would you want to invest?
Historically, business ventures like Amazon have had two phases: a fast growth phase, and a long, stable, profitable phase. You don't expect profits while the business is still growing. You expect them to plow the profits back in to make it grow more. As long as companies can maintain absurd year-over-year growth, investors are willing to pretend that the company needs its giant cash piles to grow more faster. This is actually the rational reason why the stock market shoots a brick whenever one of these tech companies only increases its profits by 23% instead of the projected 27%.
Hypothetically, what Amazon's share price means is that investors believe that it will return more than that many dollars per share to its investors once it switches from its fast growth to its slow-and-steady phase.
Hypothetically; stock also has value because the expectation that it will go up or down creates a class of investor who buys or sells it based on its expected price regardless of its fundamentals, which can affect the price in either direction.
"Profit" is either "money you haven't spent yet" or "money you need to return to investors". Modern corporations have been telling investors to eat a bag of salted peanuts lately, so they really don't care about returning profits to investors. So if "profit" is just "money you haven't spent yet", you're better off spending it before you pay taxes, because then you get to spend X% more.
The individuals running the company are presumably compensating themselves lavishly to run a company with no profits.