If $229 billion was the GDP of a country, it would place within the top 50 economies in the world. Instead, it's the amount of revenue Apple (AAPL -0.69%) generated -- in just the past year.

Here are some more numbers:

  • $48 billion in profit.
  • $51 billion in free cash flow.
  • $269 billion in cash and investments.

These figures are staggering. And together, they've helped Apple's stock achieve a mind-blowing $900 billion market cap. Yet as hard as it may be to fathom, Apple's shares are still undervalued. In fact, here are three reasons investors may wish to buy the tech titan's stock today.

An apple with a bite taken out of it

Now's a great time to take a bite of Apple's stock. Images source: Getty Images.

A strengthening ecosystem

Skeptics say Apple is simply a glorified hardware company -- one whose margins will eventually be eaten away by an onslaught of lower-priced competition. However, I'd argue that Apple is as much a software and services business as it is a hardware company. And it's this aspect of Apple's business that gives it its most powerful edge.

Apple's four major software platforms -- iOS, macOS, watchOS, and tvOS -- provide seamless experiences across all Apple devices. For example, you can start an email, edit a document, or surf the Web on your Mac, and then pick up where you left off on your iPhone. This makes a Mac inherently more useful to an iPhone owner than a comparable Windows-powered computer. The same can be said for the iPad and Apple Watch, versus other tablets and wearable devices. Thus, once people enter Apple's ecosystem by buying one of its devices, they're much more likely to buy another Apple device instead of that of a competitor. This is Apple's so-called "halo effect," and it continues to serve the company well.

Moreover, Apple's booming services business -- which includes the App Store, iTunes, Apple Pay, and Apple Music -- is helping to strengthen this halo effect and make its products even more "sticky."

People spent nearly $40 billion on App Store purchases alone in 2017. That's more than twice what was spent on Google Play during that same time. This is an important advantage for Apple, because once someone purchases apps on an iPhone, that person is much less likely to switch to an Android-powered phone, since he or she could have to repurchase the apps to continue using them.

Apple Music and Apple Pay likewise help to increase the switching costs for users, thereby further strengthening the tech titan's ecosystem. They're also helping to bolster a rapidly growing stream of recurring revenue from the more than 1 billion Apple devices currently in use.

Massive capital returns

These powerful competitive advantages allow Apple to earn a profit margin that's well above industry norms. In turn, Apple has an incredible ability to generate free cash flow; the company was able to produce about $22 in FCF for every $100 in sales in 2017.

There was a time when Apple would simply let that cash accumulate on its balance sheet. But under CEO Tim Cook's leadership, Apple has taken a more shareholder-friendly approach. Back in 2012, the tech titan implemented a capital return program. Since that time, Apple has delivered $234 billion to shareholders in the form of dividends and stock buybacks. And by 2019, the company intends to up that figure to $300 billion. These capital returns should continue to help to support Apple's stock price, while also providing investors with a steadily rising stream of dividend income.

An attractive valuation

Better still, all this can be had at a bargain price. Despite its strong competitive position, Apple is trading at a discount to the market as a whole, as measured by the S&P 500. Apple's shares can currently be had for about 19 times trailing earnings and 14 times forward estimates. That compares with a trailing and forward P/E of nearly 23 and 19, respectively, for the S&P 500.

On an ex-cash basis, Apple's shares are even more attractive. Investors have typically discounted the value of this cash, since the large majority of it is held overseas. But under the new repatriation tax law, Apple's foreign reserves will be taxed at a far lower rate than they otherwise would have. Apple is therefore expected to repatriate much more of its international cash reserves, and therefore more likely to deliver this cash into the hands of its shareholders through dividends and buybacks.

If we back out the net cash on its balance sheet -- currently about $114 billion, after adjusting for repatriation taxes -- Apple's trailing and forward P/E ratios fall to 17 and 13, respectively. That's a terrific price for one of the most competitively advantaged businesses available in the market today. And it makes now a great time for investors to consider buying Apple's stock.