Funding $7 billion in 2022 for work in 141 countries, the Bill & Melinda Gates Foundation is one of the most recognizable -- and largest -- philanthropic organizations around. From initiatives supporting gender equality to global health, the foundation proclaims that it's "guided by the belief that every life has equal value."

To provide its ample financial assistance to so many, the foundation has developed a strong investment portfolio that includes a variety of stocks. But it's two stocks, Berkshire Hathaway (BRK.B -0.69%) and Canadian National Railway (CNI 0.36%), that do the heavy lifting, accounting for more than 34% of its holdings. Two Motley Fool contributors examine why these two tickers hold such prominent places in the foundation's portfolio.

Berkshire Hathaway: A valuable option for investors

Lee Samaha (Berkshire Hathaway): Although Warren Buffett is no longer a trustee of the Bill & Melinda Gates Foundation, his influence still looms large in its investments. Not least because Buffett's Berkshire Hathaway made up the Foundation Trust's third-largest holding as of the first quarter of 2023.

Buffett's investment philosophy has stood the test of time, and the managers entrusted to carry on the Berkshire Hathaway legacy will also have been thoroughly imbued with the investment approach of Buffett and his partner, Charlie Munger.

This approach isn't always apparent from Buffett's listed holdings. While investors pour over every listed stock Buffett owns, and rightly so, in an attempt to try to model a Buffett-like portfolio, it's worth noting that investing in Berkshire Hathaway also gives exposure to all the privately held subsidiaries Berkshire has invested in. 

They include major businesses like BNSF Railway, aerospace and defense structural products manufacturer Precision Castparts, major insurance and reinsurance companies (Geico and General Re), gas pipelines, and household names like Kraft Heinz, Duracell, Dairy Queen, See's Candies, and many more.

It's an eclectic mix of businesses, and investors won't get exposure to them without buying Berkshire stock -- something to think about for investors looking to mimic Buffett's portfolio.

A rail stock from the Great White North

Scott Levine (Canadian National Railway)A holding that represents 17.7% of the fund's portfolio, Canadian National Railway accounts for the second-largest position after Microsoft. Since initiating its position in Canadian National Railway 10 years ago, the Bill & Melinda Gates Foundation has been a steady buyer of the stock, increasing its stake from 8.6 million shares in Q2 2013 to the current position of about 54.8 million shares. Currently, the foundation is the largest shareholder of Canadian National Railway stock.

Canadian National Railway has a history that stretches back almost 100 years. Over the past century, the railroad has grown considerably. Stretching about 20,000 miles, the rail network that Canadian National Railway operates connects the Atlantic and Pacific coasts with the Gulf of Mexico.

Serving a vital role for U.S. and Canadian businesses across a variety of industries, Canadian National Railway generates strong free cash flow that helps sustain its dividend.

CNI Free Cash Flow Per Share (Annual) Chart

CNI Free Cash Flow Per Share (Annual) data by YCharts.

The steady dividend is surely a major reason why the Bill & Melinda Gates Foundation finds the stock so alluring. Since Canadian National Railway paid its first dividend in 1996, the company has increased its payout at a 15% cumulative annual growth rate.

While the position in Canadian National Railway is sizable, it's not the only exposure to rail companies that the foundation has thanks to Berkshire Hathaway, which -- as mentioned earlier -- includes BNSF Railway among its assets, operating it as a wholly owned subsidiary.

Should you follow the Bill & Melinda Gates Foundation's lead?

It's unsurprising that the Bill & Melinda Gates Foundation is so committed to Berkshire Hathaway and Canadian National Railway. For those seeking to fortify their portfolio with one of the most resilient and trusted tickers available, Berkshire Hathaway is a sure bet. On the other hand, those interested in a conservative approach that also provides passive income would be well-served to take a close look at Canadian National Railway.