Company A grows revenues at %5 per annum. Company B grows revenues at %4.9 per annum. In both cases the trend is equally likely to continue in perpetuity. And neither company is expected to ever pay dividends.
Which stock are people going to buy? _Everybody_ is going to buy Company A's stock and _nobody_ is going to buy Company B's stock. P/E doesn't matter because 1) no dividends and 2) it's not a proxy for relative risk (we established risk is identical between the two).
Amazon is special because it's potential for revenue growth is believed to be nearly unlimited. As long as they're not losing money, and as long as they have enough profits to continue growing revenue, people will keep investing. Once the specter of stagnant revenue growth appears, Amazon's stock will probably come crashing down.
Basically, investors chase revenue growth, not profits. Berkshire Hathaway works the same way. Buffet might be a value investor who buys companies that can grow profits, but the price of BRK.A tracks the revenue growth of the holding company, not its profits.
Conversely, Wal-Mart's revenue growth has completely stalled. In fact, the stock price plummeted the year that revenue decreased slightly.
This is how things look as far as I can tell. I'm not a financial professional, and even if I'm right I'm sure there's a far better way (more technical, more comprehensive) to explain this dynamic.