Bill Gates and Warren Buffett, the two richest Americans, share a friendship, a commitment to philanthropy and an interest in railroad investments. In 2014, Gates’s trains are the better performers.

Canadian National Railway Co. is beating benchmark stock indexes as profits and shipments surge, a boost for Gates, the largest shareholder. At C$64.5 billion ($59 billion), the railroad today passed Suncor Energy Inc. to become Canada’s fourth-largest company by market value.

BNSF Railway Co., owned by Buffett’s Berkshire Hathaway Inc., is struggling. North America’s biggest railroad by sales is grappling with slow traffic and is being scrutinized by U.S. regulators for poor service, spurring concern that it risks a permanent loss of some customers.

“CN still is the gold standard today, and they continue to execute extremely well,” said Stephen Groff, a fund manager at the Cambridge Global Asset Management unit of Toronto-based CI Investments Inc., which owns Canadian National stock. BNSF “is having some real problems. They are fixing these problems, but they are a little late.”

While the recent growth at Montreal-based Canadian National extends the carrier’s history of operating efficiency, BNSF’s stumbles are a rare setback for the railroad that Buffett dubbed an “all-in wager” on the U.S. economy.

Tardy Pickups

Winter storms and record demand for grain shipments snarled rail operations across the U.S. and Canada in early 2014. In July, Canadian National CEO Claude Mongeau said the railroad’s grain-shipment chain was “fully back in sync.” About a month later, Fort Worth, Texas-based BNSF reported having 2,029 rail cars for grain pickups past due by an average of almost 11 days.

BNSF’s operating ratio, a measure of costs against revenue, was second-worst among seven major North American carriers last quarter, according to data compiled by Bloomberg. Canadian National’s was the best.

“CN is probably going to remain the most efficient railroad,” said Philippe Le Blanc, whose Cote 100 Inc. asset- management firm in Saint-Bruno, Quebec, owns Canadian National stock among the C$500 million it oversees.

Gates controls about 13 percent of Canadian National through his Cascade Investment LLC and the Gates Foundation, data compiled by Bloomberg show, and those holdings were valued at about C$8.1 billion, based on the Aug. 29 closing price. The Microsoft Corp. co-founder is the world’s wealthiest individual with a net worth of $84.5 billion, according to the Bloomberg Billionaires Index, while Buffett is No. 3 with $66.7 billion.

Stock Boost

Canadian National’s 29 percent surge this year through Aug. 29 added about C$1.8 billion to the value of Gates’s stake and beat the 15 percent gain for the benchmark Standard & Poor’s/TSX Composite Index. The stock rose 1 percent to C$78.83 at 10:19 a.m. in Toronto, extending a leap of about 10-fold since Gates, 58, disclosed his initial purchase in October 2000.

Michael Larson, Cascade’s chief investment officer in Kirkland, Washington, didn’t return phone messages seeking comment about Canadian National, and Mark Hallman, a railroad spokesman, declined to make Mongeau available. Buffett, 84, didn’t respond to a request for comment sent to an assistant.

Canadian National began 2014 with a quarterly profit report that missed analysts’ estimates when colder-than-normal weather forced it to run shorter trains. Last month, Canada’s government ordered the company and Canadian Pacific Railway Co. to ship a minimum of more than 1 million metric tons (1.1 million tons) of grain a week during the fall harvest to prevent a recurrence of a backlog that gridlocked farmers’ crops last winter.

Forecast Tweak

Canadian National had already begun to catch up. In July, it forecast a “solid double-digit” increase in 2014 earnings per share, a refinement of a January assurance that the railroad was “aiming for” growth of at least 10 percent.

“They’re firing on all cylinders,” said Garey Aitken, chief investment officer at Franklin Templeton’s Bissett Investment Management unit, said by phone from Calgary. The C$2.6 billion Bissett Canadian Equity Fund counts the railroad as its second-largest holding.

BNSF has sent more than $14 billion to its parent since being acquired in 2010, regulatory filings show. That’s when Omaha, Nebraska-based Berkshire bought the remaining 77 percent for $26.5 billion after disclosing stakes starting in 2007. This year, BNSF plans a record $5 billion in capital spending, along with hiring 5,000 workers and adding 500 locomotives.

Improving Service

“We will continue to do the things necessary to meet customer demand and improve our service delivery,” Michael Trevino, a railroad spokesman, said by e-mail.

BNSF’s lines jammed up as carloads surged for products such as coal, grain and oil, along with intermodal shipping containers. In June, the U.S. Surface Transportation Board told BNSF to report weekly on how far it’s behind in moving grain.

“They had all of their four main markets in that territory explode simultaneously,” said John Larkin, an analyst at Stifel Financial Corp. in Baltimore. “That network was never designed to handle that much traffic.”

Some railcars are sitting idle, and some customers have jumped to other railroads. For the four weeks ended Aug. 23, BNSF’s carloads dropped 1.9 percent while Canadian National’s rose 10 percent.

Canadian National may be among the beneficiaries of BNSF’s difficulty in running trains on time, said Joseph Schwieterman, a DePaul University transportation professor in Chicago. A Canadian National line serving the U.S. Midwest is positioned to add business from container shippers, he said.

‘Some Risk’

“There is some risk for BNSF,” Schwieterman said by phone.

Intermodal freight is Canadian National’s biggest business, accounting for 23 percent of second-quarter revenue. Petroleum and chemicals are next at 18 percent, and the company predicts crude volumes will continue to advance.

Canadian National’s price-earnings ratio of 23.6 now exceeds the 22.5 average for the six largest publicly traded North American railroads, Bloomberg data show. On that basis, Canadian Pacific is the most expensive railroad with a ratio of 29.6.

Investors such as Aitken say they plan to hang onto their Canadian National holdings.

“We don’t struggle with the valuation at all,” Aitken said. “When we look at free cash flow and the growth profile of that free cash flow, the valuation is excellent. We have a business here that is going to be around 50 or 100 years.”