After a 36% rise over the last 12 months, Canadian National Railway (NYSE: CNI) has certainly rewarded investors. But does the company have a wide enough moat to keep competitors at bay for the long haul?

The stuff moats are made of
Warren Buffett coined the term "economic moat" to describe the strength of a company's competitive advantages. Many factors confer short-term competitive advantages, but in his excellent The Little Book That Builds Wealth, Morningstar's Pat Dorsey convincingly argues that only four factors create an enduring economic moat. Let's use Dorsey's criteria to see what Canadian National Railway's moat is made of, and just how sustainable it is.

1. Intellectual property rights
Moat-building intellectual property includes intangible assets like patents, licenses, and brands. Any company can have a brand, but truly moat-widening brands must increase a consumer's willingness to pay for a product.

Moat source: No
Producers typically don't care which railroad they use; they just want a company that can transport their goods or commodities to the target destination quickly and cheaply.

2. Customer switching costs
Products that are tightly integrated with a customer's business or lifestyle make it difficult for that customer to switch to a competitor's product.

Moat source: No
Similarly, there is no loyalty in the railroad business. Producers will gladly switch to one of Canadian National's competitors, like Norfolk Southern (NYSE: NSC) or Union Pacific (NYSE: UNP) -- or even a trucking company if the price is right.

3. The network effect
The value of some services increases in direct proportion to the number of people using them. For example, Facebook offers a much richer experience with 500 million users than it did with a handful of undergraduate dorm-mates.

Moat source: No
Existing Canadian National customers realize no benefit as the railroad inks new customers. In fact, their service may suffer as a result.

4. Cost advantages
Finally, lower costs can create lasting competitive advantages. The benefits of operational efficiencies and smart processes inevitably erode over time. A truly sustainable cost advantage, like economies of scale or a superior geographic location, simply can't be copied.

Moat source: Yes
Here's where Canadian National really shines. With 20,000-plus miles of track, Canadian National is the only railroad that crosses the continent both East-West and North-South, serving ports on the Atlantic, Pacific, and Gulf coasts. These rail lines were expensive to build and maintain, but they provide Canadian National with a critical asset that's impossible for competitors to duplicate.

Numbers don't lie
To determine whether a company enjoys a sustainable competitive advantage, examine its return on invested capital (ROIC) over time. Returns consistently exceeding a company's cost of capital suggest that it possesses a nice moat. Here's how Canadian National's ROIC stacks up next to its competitors:

Company

FY2007

FY2008

FY2009

Canadian National

11.5%

10.6%

8.5%

Nortfolk Southern

9.9%

11.8%

7.2%

Union Pacific

9.3%

10.7%

8.3%

Source: Capital IQ, a division of Standard & Poor's.

Survey says: Narrow moat!
As you can see, although Canadian National is the industry leader, with the best operating margins in the industry, the company tends to earn steady, but not spectacular returns on invested capital. That's because despite Canadian National's terrific network of railways, it faces continuous and heavy reinvestment needs. If you have a lot of capital to deploy and you're looking for a consistent performer, Canadian National may be right for you (perhaps that's why Bill Gates is a major shareholder).

Ready to buy?
Not so fast, my Foolish friends! Even if you believe that Canadian National can widen its narrow moat and fend off the competition, that doesn't automatically make it a smart buy. While competitive advantage is critical, it's also essential for investors to have a strong understanding of a company's management, finances, and valuation -- and to always buy at a significant margin of safety.

That's the strategy our team at Motley Fool Inside Value employs. You can read all of the team's research reports, and see their best buys for new money now, with a 30-day free trial.