On the surface, Home Depot (HD 0.17%) and Apple (AAPL -1.00%) have nothing in common. One's a high-flying technology company that redefined communications with its smartphones, and the other is a boring hardware retailer.

However, one thing that unites these two companies is their incredible performance over the past decade. Apple has grown its market capitalization 434%, rapidly closing in on a $1 trillion valuation, while Home Depot has increased market cap by 330%. For comparison, the S&P 500 has increased by only 77% in this period.

Based on financial media coverage and market capitalization, you'd expect an investment in Apple to be worth more than an investment in Home Depot 10 years ago -- and you'd be wrong.

Investor on computer and looking at investing statement.

Image source: Getty Images.

Home Depot beat Apple in total return

In the past 10 years, an investment in Home Depot has provided investors with a total return of 709%, nearly 100 percentage points higher than Apple's total return of 614%. To understand how Home Depot has unassumingly been able to outperform the most widely followed stock on the planet, it's important to disaggregate total return from market capitalization return.

HD Total Return Price Chart

HD Total Return Price data by YCharts. (Author's note: Because of differences in timing, return may be slightly different on multiple charts.)

Market capitalization is based on two factors: share price multiplied by the number of shares. Total return incorporates returns from both market capitalization increases, per-share price increases from lowered share counts, and returns from cash distributions to shareholders in the form of dividends. For investors, total return is the best metric of a stock's performance, because it represents the true increase in wealth resulting from the investment.

Price appreciation shows the brilliance of Home Depot's buyback policy

The largest difference between market capitalization increases and per-share price return increases is share count reductions. As the following chart shows, although Apple and Home Depot are separated rather significantly on market capitalization growth, they are close as it relates to per-share price appreciation.

HD Market Cap Chart

HD Market Cap data by YCharts. (Author's note: Because of differences in timing, return may be slightly different on multiple charts.)

In the past five years, Apple has engaged in an aggressive share buyback program to the tune of $166 billion, lowering its split-adjusted outstanding shares by 17% from a decade ago. Home Depot, on the other hand, has repurchased "only" $51 billion of stock over the last decade but has lowered its share count by more than 33% because of timing and market capitalization differences. Home Depot's buyback policy has allowed the stock to reward investors at a similar level to Apple even as the overall market cap has not grown as quickly.

Dividends are Home Depot's secret weapon

Where Home Depot truly beats Apple is the company's history of dividends. In the last decade, the hardware retailer has paid $21 billion in dividends, and currently yields 1.9%. In the last decade the company has doubled the total cash it pays in dividends while decreasing its per-share count 33%.

For a better comparison, a decade ago Home Depot paid $0.90 per share total in 2007; it paid $0.89 per share last quarter. It is this long-term dividend policy that provides the difference between price return and total return. It's also been the reason that an investment in Home Depot has outperformed Apple.

HD Chart

HD data by YCharts (Authors Note: Due to Differences In Timing, Return May Be Slightly Different on Multiple Charts)

In 2012, soon after new CEO Tim Cook took over for Steve Jobs, Apple's decided to pay out a dividend, and has since increased its payout 231% in the last five years. The chart above shows this with Apple's total return starting to separate from its total return.

Capital allocation matters for investors

The difference between Apple's returns and Home Depot's shows how important capital allocation is to investors. Corporate finance dictates that any cash management feels cannot make returns higher than its cost of capital should be immediately returned to shareholders, as it's their cash. Home Depot has been among the most aggressive at returning cash back to shareholders in both buybacks and dividends, and has provided investors more than double the returns than its market cap growth.

Apple on the other hand continues to invest in research and development and growing its cash hoard in the event a new, high-growth opportunity presents itself (there's also a not-so-minor issue of cash repatriation as well). However, because Apple is a cash-producing juggernaut, the company will be able to pay dividends, buy back shares, and produce considerable returns on its invested capital for years to come. For investors, this shows there's multiple ways investors can get wealthy investing in high-quality companies.