Railways are one of the oldest industries in North America, but most of the biggest rail companies have significantly beaten the market in the past five years.

In this week's episode of Industry Focus: Energy, Motley Fool analysts Sean O'Reilly and Taylor Muckerman dive into the railroad industry. Find out the six biggest rail companies investors will want to keep an eye on, which of those have the most compelling story going forward, why the industry is seeing such incredible growth in the past five years, some of the biggest risks and most exciting prospects for the rail industry, and more.

A full transcript follows the video.

10 stocks we like better than CSX
When investing geniuses David and Tom Gardner have a stock tip, it can pay to listen. After all, the newsletter they have run for over a decade, Motley Fool Stock Advisor, has tripled the market.*

David and Tom just revealed what they believe are the 10 best stocks for investors to buy right now... and CSX wasn't one of them! That's right -- they think these 10 stocks are even better buys.

Click here to learn about these picks!

*Stock Advisor returns as of June 5, 2017

This video was recorded on June 8, 2017.

Sean O'Reilly: Welcome to Industry Focus, the podcast that dives into a different sector of the stock market every day. Today is Thursday, June 8, 2017, so we're talking about energy, materials, and industrials. I'm your host, Sean O'Reilly, and to my left is one of the coolest guys that I know at Fool HQ.

Taylor Muckerman: You reached for that. I saw you struggling for something to say.

O'Reilly: In my defense, I looked over and said what immediately came to my mind. Eh? Eh?

Muckerman: It started off as a blank stare. [laughs] 

O'Reilly: Really, it was like, oh my God, I can't believe he's wearing that shirt.

Muckerman: Again.

O'Reilly: Again. We're kidding, folks; we love each other. So on today's show, we're talking railroads.

Muckerman: Yeah, not something we've traditionally talked about.

O'Reilly: No, but we should, because they're awesome.

Muckerman: They are, except for investors.

O'Reilly: First, I have to know, did you have any model train sets as a child?

Muckerman: I did. One. My grandpa got me one when I was 5.

O'Reilly: They do that. 

Muckerman: It was cool, because when you're 5, it's pretty lengthy, and you put a VHS in the VCR, and it pretended to be what the train was seeing, what the train was going through.

O'Reilly: [laughs] I didn't know they sold companion VHS tapes for these things!

Muckerman: Oh, yeah. So that lasted for about a year or two. Then I turned 8. 

O'Reilly: Do you think we could find this VHS-train duo on eBay or something? I might do that.

Muckerman: Yeah. I mean, eBay would be the place to get that.

O'Reilly: I was looking on eBay the other day. Did you ever play around with a Commodore 64?

Muckerman: No.

O'Reilly: My dad had one of those from the '80s, and it's like a 64-bit computer. This thing is rough. But it was fun. It was nostalgic.

Muckerman: I thought, Nintendo 64, that was a 64-bit video game.

O'Reilly: Oh, you know what, it was probably less, like 8-bit or 16-bit, because this was a computer from the '80s.

Muckerman: Yeah, it's typically double, so 8, 16, 32, 64.

O'Reilly: I'm going to say Commodore 64, maybe 8-bit or 16-bit. But do you know what it reminded me of? There was a Commodore 64 logo on a mug at the office here. I don't know why.

Muckerman: A lot of video games going on here at Fool HQ.

O'Reilly: Lots.

Muckerman: Were they lying about the 64? Was it foreshadowing of the industry and the potential?

O'Reilly: I don't know. We'll look it up on Wikipedia later.

Muckerman: Yeah. Maybe your Commodore 64 or my train set will be delivered via rail if you buy it on eBay.

O'Reilly: Perfect. Actually, that was decent, because it's so cost-effective, as we'll soon find out. Really quick, as a primer, the history of rails, kind of a long one. Fun fact: Ancient Greece actually had man-hauled railways, basically just carts on tracks. That's ancient Greece, over 2,000 years ago. But it really took off with the invention of the steam engine during the Industrial Revolution. So they put a steam engine on one of these carts on rails, and that's a railroad. We all know that railroad companies were the favorite playthings of the robber barons in the late 1800s, the foremost of which was Cornelius Vanderbilt and his New York Central Railroad. Industries mature; time goes on.

Muckerman: Atlases shrug.

O'Reilly: Atlases shrug, people become prime movers, some don't, all kinds of fun stuff. Good Ayn Rand reference. Good for you. But just because of maturity and industry consolidation, there's only a handful of railroads in North America, right?

Muckerman: A handful of meaningful ones that investors should probably care about, yeah.

O'Reilly: I don't know if you have any to add here, but I counted Canadian National Railway (CNI 0.27%).

Muckerman: That's my favourite. Give away the kitty there. That's "favourite" with a u.

O'Reilly: Union Pacific (UNP -0.20%)CSX (CSX -0.57%), Burlington North Santa Fe, which is owned by everyone's favorite billionaire investor, Warren Buffett. He bought them -- was that right after the recession or during?

Muckerman: I don't remember the time. He bought it in multiple tranches.

O'Reilly: Let's call it eight years ago. Kansas City Southern (KSU), Norfolk Southern (NSC -0.07%), and Genesee & Wyoming (GWR) is the smallest that I found -- market cap of $4 billion, give or take.

Muckerman: Yeah, I don't know too much about them. Not a slight against them. I just haven't looked into it.

O'Reilly: Yeah, it is what it is. Now, Taylor, these have been great stocks to own over the last number of decades.

Muckerman: Yeah. If you're trying to beat the market, you should have loaded up on some railway stocks in the last five or 10 years.

O'Reilly: Drop some knowledge for us.

Muckerman: Alright. This doesn't include dividends, by the way. Imagine the returns you'd be swimming in if you had reinvested dividends, or even just accepted the dividends and put them in your bank account. Over the last 10 years, S&P 500 up 57%.

O'Reilly: Cumulatively.

Muckerman: Cumulatively. The best-performing railroad out of the six I have here would be Union Pacific at 262%.

O'Reilly: That'll do.

Muckerman: So, roughly 5x --

O'Reilly: And this is the oldest, most boring industry ever.

Muckerman: Supposedly. And then second, you have Canadian National at 183%. A little bit more than 3x the market. Then, three of them in the 112% to 124% range, and that's Norfolk Southern, Canadian Pacific, and Kansas City Southern.

O'Reilly: Why?

Muckerman: They're so damn important.

O'Reilly: Important?

Muckerman: Yes. They're vital to the economies of North America and the world in general. But, as we are North American investors --

O'Reilly: Actually, thanks for the pivot there. When I was doing my research, I just meandered on over to the Berkshire Hathaway report, because I was curious what was going on with Burlington Northern Santa Fe, and I knew that Buffett would have some homespun but incredibly insightful, brilliant thoughts --

Muckerman: As he's wont to do.

O'Reilly: It happens occasionally. We'll get to this a little bit in a minute, but the last couple years have not been great for Burlington Northern in terms of profits.

Muckerman: Have they not?

O'Reilly: No. We'll get into why ... oil. 

Muckerman: Ah, yes. Warren Buffett's company was one of the first to get into crude by rail.

O'Reilly: Right. And it worked for a while.

Muckerman: It did, until November 2014.

O'Reilly: It might come back. Anyway, Warren Buffett's Burlington Northern Santa Fe operates about 32,500 route-tracked miles in 28 states and three Canadian provinces. So you want to talk about vital, this is the entire western United States.

Muckerman: Right, basically the entire U.S. and Canada, apparently.

O'Reilly: Yeah, I would assume they pop up in Vancouver or whatever. Anyway. Do everything -- consumer products, coal, industrial products, agricultural --

Muckerman: Commodities, chemicals, automotive, transportation, the list goes on. 

O'Reilly: Right. So, what was interesting to me was, Buffett, in his report, this is the 2016 report, notes that "Burlington Northern Santa Fe, like other Class 1 railroads, uses only a single gallon of diesel fuel to move a ton of freight almost 500 miles. Those economics make railroads" -- are you ready? -- "four times as fuel efficient as trucks."

Muckerman: How do you hate that?

O'Reilly: I didn't know that. That's like, good God. 

Muckerman: As long as they're running properly, you don't have to deal with traffic; weather delays very rarely. These conductors aren't parking on the side of the highway and sleeping in the back of their engine.

O'Reilly: Right. You need trucks for that last little bit of the trip, to get to the grocery store or whatever.

Muckerman: Yeah, the driveway style, yeah.

O'Reilly: But four times ...

Muckerman: It's no joke.

O'Reilly: Wow. So they're huge, they're vital. We'd actually be very much in trouble without these railroads. And incredibly cost-effective. This is like, whoa.

Muckerman: Yeah, I knew they were cost-effective. But yeah, 4x the trucking industry, and there's potential to be even more efficient if they have automated rail cars and things like that.

O'Reilly: So, results over the last three years -- and I can't wait to get to the other railroads -- 2016 revenue for Burlington Northern Santa Fe, $19.8 billion. 2015, just under $22 billion, so a bit of a drop there. That was down from 2014, $23.23 billion. So over three years, that's about $4 billion in revenue. That's 16%. Profits have stayed the same. They've gotten more efficient, actually. Plus diesel fuel prices have dropped a little bit, so that's nice.

Muckerman: Diesel prices are down a little bit.

O'Reilly: Profits in 2014 were $3.87 billion, and 2016 $3.569 billion. This is all fine. It's still throwing off tons of cash. And there's depreciation charges in there. I think last year there was $2.1 billion in depreciation and amortization charges, which, in a capital-intensive industry like railroads, it's real. They spend billions upgrading track and fixing things.

Muckerman: Yeah, they have to. I think it's partially because sometimes they share track, which is necessary. I'm sure the government has some mandates in there in order to upkeep. 

O'Reilly: You're talking about, like, Amtrak, right?

Muckerman: That or, I know they have regulations on rail-car specifics, in order for safety measures -- that was a big deal with crude by rail, and we had a couple train derailments.

O'Reilly: Oh, and that's the Class 1 stuff you're talking about.

Muckerman: Yeah, exactly. And you saw the stock -- I can't remember the name of the company, but it was a company that makes rail cars, and their stock shot through the roof when all of a sudden the U.S. was like, "We're going to implement some regulations on crude-by-rail oil tankers." Then I think that fluttered out and the stock price returned to Earth. But there are different ways to invest in the rail industry, rather than just the operators, for sure.

O'Reilly: Right. So how have the other guys been doing? Burlington Northern rode the oil wave for a while there. It was crushing it with results from the recession until when OPEC did their thing on Thanksgiving in 2014.

Muckerman: And coal has hurt a few of these --

O'Reilly: That was the other thing he cited. It was oil and coal, and it was like, the volumes are dropping.

Muckerman: CSX has been significantly hurt by coal comparatively, because they have the Eastern operations. They are the east-of-the-Mississippi railroad.

O'Reilly: And these are the older cities in America. Coal-generating power plants. And they're trying to shut them down.

Muckerman: And the coal-mining areas of Appalachia. For CN Rail, 2016 revenues did step back a little bit, but revenues, first quarter 2017, up 8% versus last year, so some growth there. But from the top line down, or just below the top line but all the way down to net income, results were up basically year over year. There's a couple small misses from 2010 until 2016. Same thing for the likes of CP, Canadian Pacific (NYSE: CP). All dividend payers. And they keep them relatively safe. They're all right around that 1.5% to 2% range. The highest I've seen is Union Pacific at 2.18%, and the lowest, Kansas City Southern at 1.38%.

O'Reilly: So these aren't crazy high, but they're respectable.

Muckerman: Yeah, but the thing about it is, they're growing. So the yields might not be growing, but the payments are growing, and historically, those are the companies you want to own as an investor, because yeah, if they hold the payment consistent, that's great, you're still making money as a dividend. But if you're growing that dividend consistently, that's what you want. And if you look at CN Rail, the dividend in 2010 per share, $0.54. Last year, $1.50.

O'Reilly: That's weird.

Muckerman: Almost 3x increase in dividends per share. CSX raised their dividend last year by 11%. Canadian Pacific, 2010 dividends per share $1.06; last year, $1.85. So, growing payments, growing stock prices, this is what you want. But if you want to look at some diversity, just to show you, CSX, 67% of their transportation is for merchandise, 17% for coal, and 16% for intermodal, which is basically containers that you can take off a ship, put directly on a truck or rail, take off any three of those and just put it right back on the other one. For comparison, CN Rail, they have ... eight categories, the highest of which is intermodal at 23%. Coal is only 4% for CN.

O'Reilly: That's a winner right there.

Muckerman: Then they have grain and fertilizer at 19%.

O'Reilly: Is that why you like them?

Muckerman: They span the entirety of North America. They have an east-west rail line from basically Vancouver to the East Coast of Canada, and then they run south from the middle of the country down through Chicago, and they connect in two ports in Mobile, Ala., and New Orleans.

O'Reilly: So it's like a T.

Muckerman: Yes, basically. Which makes it very easy, comparatively, to operate, whereas if you look at CSX's map --

O'Reilly: It's like a bunch of veins. It gets nuts.

Muckerman: Yeah, it's crazy. I've read, analysts have compared it to a bowl of spaghetti. But CSX is in a good position now, because they have the grandmaster of railroads as their CEO, Hunter Harrison --

O'Reilly: He actually said that word?

Muckerman: No, I said it, because of what he's done -- his history of dominating and leading railroads to greater operating efficiency, greater revenues, wise acquisitions, wise divestitures. 

O'Reilly: And they are crazy diversified? CSX, across product types?

Muckerman: Inside merchandising, that could be a broad category. But 67% merchandise, 17% coal, and 16% intermodal. But Hunter Harrison used to be the CEO of CN Rail, changed the game. Everybody wanted to be CN Rail in terms of operating efficiency. He left CN Rail, went to Canadian Pacific, did something very similar at Canadian Pacific, made them quite competitive, and then in January of this year jumped ship from CP to CSX. So he's in there, trying to streamline operations. They've made some employment cutbacks, they've retired and put some cars and engines into storage, and they're looking at certain real estate sell-offs in some cities where they have multiple smaller hubs, trying to condense those into one or two giant hubs in these main cities so that they're not dealing with so many complicated logistical nightmares.

O'Reilly: Awesome. So which of these guys do you like the best? Right out the gate, you were like, "I like Canadian National." Valuation? Why should I as an investor be interested?

Muckerman: When you look at Canadian National Railway, it's the most efficient in terms of expenses as a percentage of revenues, which is one of the key metrics that you look at as a railway. It's in the low 50%. Second, you have CP, Canadian Pacific, which is the only other one under 60%. So less than 60% of revenues are expenses. And then you have Norfolk Southern and CSX near 70%. So there's a lot of room for CSX and Hunter Harrison to try to bring that level down. He says by 2018, you could be looking at the low 60s, with the long-term goal of getting down to the 55 range that CN Rail is in. So I think there's a lot of room for improvement with CSX, but it really depends on if they can diversify. A little bit more heavily reliant on coal comparatively, so you definitely want to keep an eye out there. It's hard to choose, but in Stock Advisor Canada, we hitched our railcar to CN in 2014, I believe, and we're up about 6x on the market with that choice. But if you look at the charts, it's really hard to go wrong if your goal is to beat the market. If you want the best rail, that's a tougher decision. But over the last five, 10, or one year, five of the six that I talked about have beaten the market. In 10 years, all six have beaten the market.

O'Reilly: The rationale that Buffett gave when he bought Burlington North Santa Fe, from what I remember, was they're going to expand as long as the economy expands over the long term, and that's it. 

Muckerman: Yeah. And if they bring in automated railways, which, in my mind, that would be one of the safer areas to institute automotive driving --

O'Reilly: They're talking about doing it with trucking, too.

Muckerman: But you're not on a rail there. There's a lot more decision-making going in --

O'Reilly: But a rail, it'd be like a roller coaster.

Muckerman: Yeah, it might be like a roller coaster. Even the D.C. Metro is largely automated. They have someone sitting in the cab to make some decisions that might need to be changed as you're going, to control some speed.

O'Reilly: But there's a reason that they spend a set amount of time at every stop.

Muckerman: Yeah, for the most part, it's automated. So I think you could do the same thing in a much safer fashion than you could with, and possibly less regulation, trucking or cars and certainly planes. So I think that there are some advantages there. Granted, if you're a customer of these railways, and you see that they're no longer using fuel, you're going to want some cheaper cost to use their service. But at the same time, less risk, potentially fatter margins. Long-term, even if the economy doesn't continue to grow. But according to Donald Trump, we're going to be growing at 3% for the next decade if his budget plan is enacted.

O'Reilly: Yeah. I just took a quick peek at the five analysts that follow Canadian National Railway full time, that S&P Capital IQ poll, and they have them earning $5.10 a share this year, and it's expected to grow to $7.31 by 2021 in five years from now.

Muckerman: Did you happen to check who their largest shareholder might be?

O'Reilly: Well no, I didn't. Who could that be?

Muckerman: Fun fact. Bill Gates.

O'Reilly: No way.

Muckerman: Yeah. Up until just recently, an individual shareholder could only own up to 15% of a Canadian rail -- them or Canadian Pacific. But they raised that limit to 25%. So through his asset-management firm, Cascade Investments, they own 13.3%. Through the Bill and Melinda Gates Foundation, they own 2.3%. So, right there at that 15%.

O'Reilly: He's right up there, Seattle, Vancouver, he knows what's up.

Muckerman: Yeah. He's also fairly good friends with Warren Buffett. Also, top [two] richest men in the world.

O'Reilly: Yeah, they're buddies.

Muckerman: They're trying to protect and grow their wealth for the long term. And they both are in the biggest railways of either Canada or the United States.

O'Reilly: You know, Gates has a huge chunk of Waste Management, too. Garbage. Literally garbage. It's funny that he made all his money in Microsoft, and he's buying these companies.

Muckerman: That's kind of the longevity trade. If people continue to live longer, not as many people are dying, there's going to be more waste being generated as we keep prolonging our individual deaths.

O'Reilly: Dark.

Muckerman: That's not dark. It's optimistic. Honestly. If you took out opioid deaths from North America, which is on a pretty unsettling, dramatic rise, we would still be dying later. But because you're dying in your 20s and your teens and early 30s generally from overdosing on opioids, it's dragging the life expectancy down a little bit the last couple years.

O'Reilly: So if I avoid that ...

Muckerman: Yeah, if you avoid overdosing on opioids --

O'Reilly: I have so far. I'll try to keep going.

Muckerman: -- it might help enhance the longevity of humanity.

O'Reilly: Well, thanks for helping investors grow their portfolios with these rail suggestions.

Muckerman: Yeah, I'm not out here saying that CN Rail is the one to buy. It's my personal favorite at the moment. I know David Gardner recommended it in Stock Advisor many moons ago, and it was one of our first seven to eight [Stock Advisor Canada] recs.

O'Reilly: Awesome. Well, thank you for your thoughts, man. 

Muckerman: Cheers.

O'Reilly: Have a good one! That is it for us, folks. Be sure to tune in tomorrow for the Technology show with Dylan Lewis. If you're a loyal listener and have questions or comments, we would love to hear from you. Just email us at [email protected], or feel free to tweet at us, @TMFEnergy. As always, people on this program may have interests in the stocks that they talk about, and The Motley Fool may have formal recommendations for or against those stocks, so don't buy or sell anything based solely on what you hear on this program. For Taylor Muckerman, I am Sean O'Reilly. Thanks for listening, and Fool on!