On a typical Saturday afternoon, teenage me would find himself at a northeast Florida McDonald's (MCD -0.91%) after a full day of surfing with friends. I didn't even have to think about my order because I already knew what I was getting: two McDoubles and one McChicken. On my teenage budget, that was the biggest bang for my three bucks.

Much like my grandfather complaining about the things that no longer cost a nickel, it's hard not to feel nostalgic for that old McDonald's Dollar Menu when I dine at the double arches now roughly 20 years later -- my teenage order costs $7 or more today, depending on location. But it's only logical for the company to raise its prices to make more money, right?

In reality, McDonald's doesn't make big money from its menu. Through the first three quarters of 2023, the company has generated more than $7.3 billion from something that has nothing to do with hamburgers or french fries. And it's surprisingly the largest single source of revenue for the company.

Even more importantly for investors, this underappreciated business model could be its true competitive advantage, otherwise known as a moat.

McDonald's "secret" business empire

Harry J. Sonneborn was an early insider at McDonald's and has been quoted as saying: "We are not technically in the food business. We are in the real estate business." That's right, Mickey D's is one of the largest real estate empires in the world.

As of the third quarter of 2023, there are 41,200 McDonald's locations in over 100 countries. And yet, the company itself operates only about 2,100. The rest are owned and operated by its many franchisees.

The company has relatively few restaurant locations of its own, so one would think that it doesn't own much real estate. But the balance sheet shows that it has property and equipment valued at $42 billion.

Management realized the benefit of owning real estate early on. Therefore, it owns a large number of the locations that its franchisees operate. In return, franchisees must make rental payments every month in addition to franchise fees.

As mentioned, McDonald's has earned over $7.3 billion in rental income so far in 2023. This represents 63.5% of the revenue it has generated from its franchisees this year. And it represents 38% of the company's overall revenue, making real estate the biggest moneymaker.

Circling back to my McDoubles and McChicken

McDonald's owns and operates only about 5% of its locations. That said, company-owned locations do supply a lot of revenue. This is because food sales are the same as revenue at company-owned locations.

Through the first three quarters of 2023, company-owned sales accounted for 38% of total revenue for McDonald's. However, these sales only supplied a paltry 12.6% of the company's overall operating profit. Like I said, the big money comes from what it makes from its franchisees, not food.

To be clear, McDonald's must still ensure the success of its franchisees -- if they fail, it fails. The prices on its value menu (including my beloved McDouble and McChicken) have consequently increased because franchisees needed to make a profit, and certain menu items were priced too low.

Menu prices aren't irrelevant for McDonald's, but the company itself doesn't make the majority of its profit from food -- that's the point.

Investors can't forget that profits matter tremendously when it comes to long-term stock performance. Therefore, it's great to know that profits for McDonald's come from the much more predictable and durable real estate market.

The McMoat around its fast-food castle

When McDonald's decided to turn to a 95% franchised model, it affected the top line. Revenue is down about 11% over the past decade, but the company exchanged a low-margin revenue source (food sales) for a higher-margin one (franchise fees and rental income).

Therefore, McDonald's gross profit and earnings per share (EPS) are counterintuitively up even though revenue is down, as the chart below shows. And this leaves more money for rewarding shareholders with dividends and share repurchases, leading to great total returns.

MCD Total Return Price Chart

MCD total return price data by YCharts. TTM = trailing 12 months.

A good portion of McDonald's revenue and profit comes from a predictable source: its relationship with its franchisees. Regardless of what happens in the economy or with competition, this income stream will have relative stability. This is why I refer to real estate as a type of moat for McDonald's.

In The Little Book That Builds Wealth, author Pat Dorsey writes, "When you buy shares of the company with the moat, you're buying a stream of cash flows that is protected from competition for many years." That's what I see for investors who buy McDonald's stock today.