On the surface, these two companies don't have much in common. Quarter Pounders and mammoth data servers aren't exactly two peas in a pod. 

At the same time, however, both McDonald's (MCD 0.48%) and IBM (IBM 0.17%) have two key traits that attract scores of investors near retirement: time-tested businesses and a history of generous dividends. So if you find yourself in that cohort, which is the better stock to buy today?

Indecisive and lost man tries to choose the right path.

Image source: Getty Images.

I can't answer that question with 100% certainty. In fact, just eight months ago, I tried to discern which was the better pick between these two. My choice at the time -- IBM -- has significantly underperformed. That being said, such contests need to be viewed over the course of three years; we're still in the early innings.

Read below to see if anything has changed and which I consider the best buy right now.

Sustainable competitive advantages

If you're a long-term, buy-to-hold investor, there's nothing more important to investigate than the sustainable competitive advantage -- otherwise known as a "moat" -- that the underlying company possesses. In the simplest terms, a moat is what keeps customers coming back for more year after year, while consistently holding the competition at bay.

McDonald's key moat -- and all restaurants for that matter -- comes via its brand. While that brand has been tarnished somewhat since Supersize Me came out 13 years ago, it is still very valuable. Forbes estimates it to be the ninth most powerful in the world -- and first among restaurants -- at a $40 billion valuation.

The company's outperformance as of late comes thanks to some key changes in focus. By offering delivery and mobile ordering, as well as enhancing the in-store experience at many locations, comparable-store sales growth has shown impressive strength.

Not to be outdone, IBM also has a powerful brand name, coming in at 13th globally on Forbes list with a value of $33 billion. Importantly, that's starkly less valuable than it was last time I had this match-up: a 20% contraction in brand value. On brand alone, McDonald's is definitely winning.

But IBM also has the benefit of high-switching costs associated with its Strategic Imperatives division, which has proven popular with enterprise customers this year, and is enough to call this a draw.

Winner = Tie

Financial fortitude

Obviously, since most investors buy into these companies because of their dividends, they want to see much of that excess cash being returned to them. But over the long run, there's a strong case to be made for keeping a formidable war chest on hand.

That's because every company, at one point or another, will run into a crisis. Those that have cash on hand can usually exit such crises stronger than when they started -- by buying back shares on the cheap, acquiring rivals, or offering their products for less than the competition to gain long-term market share.

Keeping in mind that these two are roughly the same size -- in terms of market capitalizations -- here's how they stack up.

Company Cash Debt Free Cash Flow
IBM $25 billion $41 billion $11.6 billion
McDonald's $4 billion $28 billion $3.4 billion

Data source: Yahoo! Finance. Cash includes long- and short-term investments. Free cash flow presented on trailing-12-month basis.

Here the winner is clear. IBM has a much healthier -- albeit negative -- net cash position, and is pulling in much more free cash flow right now. This leads me to believe that it would actually benefit more from a potential economic crisis than McDonald's, relative to each's competition.

Winner = IBM

Valuation

Finally, we have the murky science of valuation. I say "murky" because there's no one variable that can really tell us how expensive or cheap a stock is. Instead, I like to consult a number of different metrics to get a more holistic picture.

Company P/E P/FCF PEG Ratio Dividend FCF Payout
IBM 11 12 4.7 3.9% 47%
McDonald's 27 41 2.9 2.3% 91%

Data source: Yahoo! Finance, E*Trade. P/E based on non-GAAP earnings when applicable.

IBM has the more favorable valuation on every metric except for PEG ratio, which brings earnings growth potential into the equation. But the fact that the dividend is substantially larger at IBM, and that it seems to be -- based on the amount of free cash flow used to pay the dividend -- more sustainable, makes IBM the better bet in my opinion.

Winner = IBM

My winner is...

So there you have it, while both companies have mildly wide moats, IBM has both the better balance sheet and the more favorable valuation based on today's prices. To be honest, I'm not an investor in either company, and not willing to give either a thumbs-up on my CAPS profile. Having said that, McDonald's is so richly valued that I'll go on record as saying that I think it will underperform the S&P 500 over the next three years.