Investors' outlook on each company's future growth was one factor in that difference.
Both companies have outlined future bets beyond their core businesses — advertising, particularly search, provides the bulk of Alphabet's revenue and profit now, but it vaunts YouTube, cloud computing, hardware and experimental projects like self-driving cars as growth areas.
Amazon's traditional e-commerce business continues to grow from a strong base, but cloud, advertising and hardware are all growing as well and the company is investing in tons of other long-term bets in health tech and other areas.
But there's a key contrast between these companies' long-term growth opportunities, according to Macquarie analyst Ben Schachter.
"Virtually every opportunity that GOOG invests in is going to be structurally lower margin than its core search business, whereas virtually every opportunity that AMZN invests in is going to be structurally higher margin than its core ultra-low margin retail business," he wrote in a note to clients.
In a sense, Alphabet is a victim of its own success. In 2017, the operating margin for Google (excluding long-term bets) was more than 30 percent, which is where it's hovered for years. And this figure includes businesses like cloud and hardware, which probably have a much lower margin than its core advertising business (Google does not break out operating profit or loss for these sub-businesses).
So in all likelihood, any new business it tries to conquer will have a lower profit margin.
Amazon, meanwhile, has famously run its retail business on a razor-thin margin -- it booked a tiny operating loss on $160 billion in revenue in 2017 -- so if it can win in other areas it will almost certainly deliver higher margins over time. That's already happening with its fast-growing cloud business, which had a profit margin of 25 percent (earning $4.3 billion on $17.5 billion in revenue) in 2017.
Macquarie raised its price forecast for Amazon and predicts it will be the first trillion-dollar company. It maintains an outperform rating for Alphabet.
"GOOG is clearly still doing the right thing and investing for the future, but that is a lower margin future," Schacter wrote, while noting that Alphabet has always focused more on incremental operating profit than margins.