Oftentimes, the companies that face off in these "better buy" articles are directly related. Not so today, as one of the world's largest enterprise technology companies -- IBM (IBM -1.04%) -- faces off against the largest fast-food chain in McDonald's (MCD -0.21%).

But there is one key similarity between the two: They're dividend stalwarts that are the cornerstones of many retirement portfolios. As well they should be, with dividends yielding 3.3% and 2.9%, respectively.

Money growing out of soil.

Image source: Pixabay

Which is a better buy today? That's impossible to answer with 100% certainty, but there are different ways of approaching the question. Following are three of the most important, and how these two companies stack up.

Sustainable competitive advantages

If I had one investing wish, it would be to have a time machine. I would go back nine years, run into my newbie investing self, and say, "Spend most of your time investigating a company's sustainable competitive advantages."

Often referred to as a "moat," this is the special something that separates a company from the competition. It's what keeps customers coming back week after week, while leaving the rest of the industry in its dust.

The moat is very easy to identify at McDonald's: It's one of the world's strongest and most recognizable brands. Forbes estimates that the Golden Arches  alone are worth $39 billion, the ninth most valuable brand on the planet, and the most valuable among all restaurants. That helps open up avenues for growth in foreign countries where citizens already know what McDonald's is.

Of course, the company also faces significant headwinds in the face of a new trend across the world toward healthy eating. But McDonald's isn't sitting on its hands. It's adapting -- offering slightly healthier fare, cutting back on "super sizing," and even offering all-day breakfast. Recent trends have been positive, with same-store sales increasing 4%  during the most recent quarter.

With IBM, on the other hand, many people would have trouble identifying how the company makes money today. Like McDonald's, the company has a very strong brand, worth $41 billion -- good enough to make it the seventh most valuable in the world.

But dig underneath the surface and you see a business in transition. At the risk of oversimplifying things, IBM has two business lines. The first -- which focuses on hardware -- is slowly dying. The second -- dubbed "strategic imperatives" and focusing on analyzing big data -- is the growth driver. In general, the moat is provided by high switching costs associated with transitioning away from IBM's strategic-imperatives solutions.

In the end, these two both have what I would call average moats -- they are time tested, but they're still reasonably vulnerable to competition.

Winner: Tie.

Financial fortitude

Income investors love seeing cash being returned to them, often in the form of dividends. But companies need to keep a sizable cash stash on hand, too, because every company, at one point, is going to face difficult economic times.

Those that enter such times with lots of cash on hand have options: They can buy back shares on the cheap, acquire distressed competitors, or -- most importantly -- outspend rivals to gain market share. Those with lots of debt are in the opposite camp, forced to narrow their focus in hopes of just staying alive.

Here's how these two stack up in terms of financial fortitude, remembering that IBM is valued at 32 times larger than McDonald's.

Company

Cash

Debt

Net Income

Free Cash Flow

McDonald's

$2.0 billion

$25.8 billion

$4.8 billion

$4.2 billion

IBM

$23.8 billion

$34.4 billion

$11.6 billion

$12.2 billion

Data source: SEC filings, Yahoo! Finance. Note that this was written before McDonald's released specific first-quarter figures.

While both of these companies are veritable cash-generating machines, we have a clear winner. Even after accounting for size, IBM has much more cash on hand, much higher levels of cash flow, and a much more favorable cash-to-debt ratio.

Of course, McDonald's is investing much of its money in international expansion. But we need to recognize that while that's an opportunity, it's also a threat as it makes the company's balance sheet fragile.

As such, IBM wins this round.

Winner: IBM.

Valuation

Finally, we have valuation. While we don't have a one-size-fits-all metric to compare any two companies, we can use multiple data points to make an informed analysis.

Company

P/E

P/FCF

PEG Ratio

Dividend Yield

FCF Payout

McDonald's

24

27

2.5

2.9%

72%

IBM

12

12

4.8

3.3%

44%

Data source: SEC filings, Yahoo! Finance. Note that this was written before McDonald's released specific first quarter figures.

Here we have a very muddy picture. McDonald's appears twice as expensive on an earnings and free cash flow basis, but when we take the company's growth into consideration (i.e., looking at the PEG ratio), the script is flipped -- making it look like McDonald's is half the price.

In the end, the tiebreaker is the company's dividend. Not only does IBM offer a larger yield, but it also uses less of its free cash flow to make the payout. In the end, that means IBM wins once again.

Winner: IBM.

Our winner is...

So there you have it. While recent trends have decidedly favored McDonald's, I still like IBM more over the long run. The company has a stronger balance sheet and a more favorable valuation. While McDonald's is far from being in trouble, I think investors should investigate buying shares of Big Blue first.