Railroad investors have been immensely happy recently as the industry sees year after year of booming growth. In this Industry Focus segment, Motley Fool analyst Sean O'Reilly is joined by contributor Adam Levine-Weinberg to explain the biggest reasons behind why railroads are doing so well while the shipping industry is tanking.

A full transcript follows the video.

10 stocks we like better than YRC Worldwide
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 YRC Worldwide 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 22, 2017.

Sean O'Reilly: Really quick -- last week's show I did with Taylor Muckerman was about the rail sector. There's a reason that Warren Buffett bought Burlington Northern; there's a reason that Bill Gates owns a big chunk of Canadian Northern -- I think 25% or something. Why are railroads cash cows the way they are? And I pulled up the numbers for YRC Worldwide (YELL 1.27%) -- that's the trucking company; we all see their trucks. In a good year, their returns on equity -- and by "good year" I mean like last year -- its average, 10.8%. In a bad year, it dips to 1% to 2%. They actually went bankrupt in the last five or 10 years, a Chapter 11 reorganization, not a liquidation or anything. But why are railroads such cash cows? The shipping sector is replete with red-ink bankruptcies. What's the deal there?

Adam Levine-Weinberg: Honestly, it's really all about tracks. For ships, you need the container ports, but often anyone can get in there, at least if it's not a really busy port, so there's a lot of competition. And in the rail sector, because of the fixed costs of getting into the rail business, if you actually want them to start a new railroad built on completely new tracks, it would be prohibitively expensive. The land and acquisition costs alone these days would be setting you back hundreds of billions of dollars to get into major metro areas. So you basically can't enter. As a result, you have half a dozen companies that control the vast majority of rail shipments in North America, at least the U.S. and Canada. That means there's a limited amount of competition. And that gives companies the opportunity to push prices up. And the biggest competition you have that would keep prices down is from truck and ship and air. But as we said, the air costs are a lot higher. The shipping is very circuitous. Even if you're just going from New York to San Francisco, it's circuitous. If you're trying to go to somewhere in the middle of the country, it's not even an option. And truck is also prohibitively expensive for these longer hauls. As a result, in that 1,000- to 2,000-mile range in the U.S., it's really just trains, and there's only a few companies that can do that for you. So that gives them a lot of pricing power and allows them to make a lot of money.

O'Reilly: So railroads are a double threat, then. You have lack of competition -- in fact, I hasten to say there's probably only one or two railroads in a given city that even service it.

Levine-Weinberg: Yeah, there's basically two railroads that do a lot of the North and South, and two railroads that do a lot of the East and West in the U.S.; two railroads in Canada. There's not a lot of options.

O'Reilly: So all these markets are a duopoly, which is just, draw your own conclusions. They're the only game in town if you're going from New York to Kansas or something.

Levine-Weinberg: Yeah, pretty much.