The harmony of Apple's (AAPL -0.40%) hardware, software, and services drove another record quarter for iPhone, Mac, and services. Apple has built one of the world's great brands, which hasn't escaped the attention of Warren Buffett, whose Berkshire Hathaway holding company is one of Apple's largest shareholders. 

What makes the stock a truly great investment is management's discipline in allocating a gigantic mountain of cash to reward shareholders, while also plowing more cash back into the heart of Apple's competitive advantage.

A person using a phone with a laptop sitting nearby.

Image source: Getty Images.

The value of Apple's share repurchases

Apple ended the quarter with a net cash position of $80 billion on its balance sheet. But free cash flow over the last four quarters reached a staggering $101 billion. Apple is returning a great deal of that excess cash to shareholders -- it returned $14 billion in dividends over the last year. But investors should pay just as much attention to Apple's share repurchases, which are significantly boosting shareholder returns by shrinking the share count.

Over the last five years, Apple's share repurchases have shrunk the company's average diluted shares outstanding by nearly 20%. Apple had 22 billion shares outstanding in fiscal 2017. It finished fiscal 2021 with 16.86 billion. This means shareholders who have owned the same amount of shares over that time have seen their percentage ownership of the company increase proportionally as the total pie shrunk.

AAPL Average Diluted Shares Outstanding (Annual) Chart

AAPL Average Diluted Shares Outstanding (Annual) data by YCharts

Another way to look at the value of repurchases is that they boost the company's growth in free cash flow on a per-share basis, which can have a positive impact on the stock price. Apple has increased free cash flow by 87% over the last five years. But due to the reduction of the share count, free cash flow increased by 140% on a per-share basis.

AAPL Free Cash Flow Chart

AAPL Free Cash Flow data by YCharts

Warren Buffett applauded Apple's share repurchases in last year's letter to Berkshire Hathaway shareholders. As of Jan. 3, 2022, Berkshire owned 5.56% of Apple. 

The math of repurchases grinds away slowly, but can be powerful over time. The process offers a simple way for investors to own an ever-expanding portion of exceptional businesses.

-- Warren Buffett

Reinvesting in the core

Apple's total revenue increased by 11% year over year in the first quarter of fiscal 2022 (which ended Dec. 25). While Apple isn't releasing breakthrough new products every few years like it was under Steve Jobs, growing free cash flow is allowing management to continue improving existing products and services to drive record revenue.

There will likely be another blockbuster hardware product at some point. After all, Apple spent $23 billion on research and development on a trailing-12-month basis. But CEO Tim Cook explained how the company is continuing to invest in strengthening its ecosystem through the intersection of hardware, software, and services. As he put it, "That's where the magic really happens." 

It's the stickiness of Apple's hardware and services that led Buffett to originally invest $36 billion in the stock. Apple's growing cash flow means it can make its devices even stickier.

Apple's moat is widening

With free cash flow surpassing the $100 billion level, investors have to appreciate how Apple isn't chasing high-profile acquisitions outside of its core business, which can destroy shareholder returns. Instead, Apple is investing big sums back into product and technology development to make its products better and widen its competitive advantage. And it's doing this while paying a growing stream of dividends and shrinking its share count to boost shareholder returns.

As Warren Buffett alluded to in his letter, Apple is an exceptional business worth holding for the long term.