It has been a great run for owners of both Alibaba Group Holding (NYSE:BABA) and Amazon.com (NASDAQ:AMZN) over the last few years. Both stocks have put up impressive numbers and rewarded shareholders, though Amazon stock has done better, with a 150% return since the start of 2016 compared with a 90% return for Alibaba.

While their operations have many similarities, an ocean separates the two e-commerce and tech platforms in more ways than one. Though the future looks bright for both, one is a better buy right now.

The e-commerce front

Alibaba and Amazon both have sprawling e-commerce empires in their core markets (China and the U.S., respectively) and are racing to expand internationally. While Alibaba is the smaller operation (trailing 12-month revenues were $42.4 billion using an exchange rate of 0.14 Chinese renminbi to U.S. dollars as of this writing), its e-commerce business is also far more profitable than Amazon's:

Metric (12 months ended Sept. 30, 2018)

Alibaba

Amazon

E-commerce revenue

$42.4 billion

$197.6 billion

E-commerce operating income

$10.9 billion

$4.3 billion

Data source: Alibaba and Amazon. Alibaba results converted from Chinese renminbi using an exchange rate of 0.14 to U.S. dollars on December 14, 2018.

E-commerce revenue for Amazon includes online and physical stores, third-party seller services, subscription services, and advertising. For Alibaba the figure includes the company's core commerce, digital media and entertainment, and innovation initiatives. Both companies are investing in new segments like online subscription services (think streaming music and video) that are still losing money but represent fast-growing businesses that could pay off down the road.

While Alibaba holds the advantage in overall e-commerce profitability, Amazon's value-added initiatives are growing faster. Alibaba's media and entertainment grew 24% year over year in the last quarter, compared to Amazon's 52% growth in subscription services. Amazon is also quickly expanding its advertising business, which is tied to its online marketplace. The segment expanded 122% in the last quarter and is now responsible for most of the profit growth in Amazon's e-commerce operations. Thus, while Alibaba currently holds the lead in e-commerce from a profitability standpoint, its U.S. rival is narrowing the gap. 

The future of computing

Over the last few years, Amazon Web Services (AWS) has received a lot of attention, and rightfully so. The fast-growing segment was an early mover in the cloud computing industry, and as such has a considerable lead over the competition. It has also been the primary driver of Amazon's profitable growth. Alibaba is a more recent entrant, generating $2.6 billion in cloud sales over the last year (at current exchange rates).

Metric (12 months ended Sept. 30, 2018

Alibaba

Amazon

Cloud computing revenue

$2.6 billion

$23.3 billion

Cloud computing operating income (loss)

($738 million)

$6.5 billion

Data source: Alibaba and Amazon. Alibaba results converted from Chinese renminbi using an exchange rate of 0.14 to U.S. dollars on December 14, 2018.  

AWS grew 46% year over year at last report, compared with 90% growth for Alibaba's cloud computing segment. However, with AWS a huge profit driver and Alibaba still running at a loss, Amazon wins the cloud computing battle.

A man entering his credit card info into a tablet to make a clothing purchase.

Image source: Getty Images.

Which is the better buy right now?

Riding momentum from growth in the digital economy, Alibaba and Amazon both look like buys for the long haul. Alibaba currently has a better e-commerce business from a profitability standpoint, but Amazon is closing the gap with new initiatives like its advertising segment. On the other hand, Amazon holds the lead in the cloud computing industry, a status that may be difficult for competitors to change.

Nevertheless, Alibaba is by far the better value at the moment. Its overall revenue is growing faster (up 41% in the last year to Amazon's 24%), and it's investing heavily to grow its business. That heavy rate of investment diminishes free cash flow -- a metric that has more than doubled for Amazon over the last year -- but Alibaba is nevertheless trading at a big discount to its American counterpart after a drubbing for Chinese stocks in 2018.

BABA Free Cash Flow (TTM) Chart

Data by YCharts.

With a price-to-free-cash-flow ratio of just 19.3 to Amazon's lofty 60.7, Alibaba looks like the better value at the moment -- though both companies likely make sense for investors who want to participate in the growth of the digital economy.

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool’s board of directors. Nicholas Rossolillo and his clients own shares of Alibaba Group Holding Ltd. The Motley Fool owns shares of and recommends Amazon. The Motley Fool has a disclosure policy.