In this segment from Market Foolery, host Chris Hill, Million Dollar Portfolio's Jason Moser, and Stock Advisor Canada's Taylor Muckerman consider a labor dispute that could have been a real issue for our neighbors to the north -- and for the U.S., too. While Canadian companies may not get a lot of media attention in this country, Canadian National Railway (CNI 0.68%) is one of the continent's biggest freight movers, and its connections to the energy industry, for example, run deep. And Canada's rail systems may be an intriguing investment opportunity, for both short- and long-term reasons.

A full transcript follows the video.

10 stocks we like better than Canadian National Railway
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 Canadian National Railway 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 May 1, 2017

This video was recorded on May 30, 2017.

Chris Hill: Canadian National Railway, which is Canada's biggest railroad, averted a work stoppage at the last minute. They were up against a deadline with the conductors union. That's a union you don't want to mess with if you're running a railroad.

Taylor Muckerman: No. There were about 3,000 of them that they were dealing with.

Hill: They struck a deal. This is, I don't know the terms of the deal, but it seems like one of those, "OK, well-played." If you have one job and your one job is running a railroad, then guess what, you need conductors.

Muckerman: They're not autonomous just yet, so yeah, you're going to need those 3,000. And I think the country of Canada, and even to some extent the United States needed this deal to happen, because of the sheer size of Canadian National Railway. You would have certainly seen the impact flow through the entire economy of Canada. And with the frack sand and coal they've been moving for the United States to the export terminals, we would have felt it, too. So, good thing all around. There's been some great news out of the company lately. They've been moving record volumes as a company, like I said, frack sand moving down south from the Wisconsin area, you see the Permian and Texas in general, the shale down there is using more frack sand than they ever have. So, that's been a huge boom for them. And coal, surprisingly, making a comeback for them. Terminal coal, so it's being exported from the United States, not necessarily being used here. Great last few quarters for this company.

Hill: How many other businesses do you think picked up the phone or sent an email in the last couple weeks as they were getting closer and closer to this deadline, saying, "You guys are going to get a deal done, right? You're going to strike a deal with the conductors? Because we need our stuff shipped."

Jason Moser: I think the bigger question beyond this though is the implications of technology, as we move forward five or 10 years from now, on industries like these. We're already seeing, to a degree, where autonomous vehicles or robots or whatever it might be, displacing people. Amazon's warehouses, that's the easy example. They bought that robot company Kiva.

Muckerman: Yeah, in 2011 or 2012.

Moser: Now you can Google the YouTube video and see how they work. They're moving these things all over the place. It's funny, I showed my mom and dad these videos over the weekend, they've never seen it and they were like, "Holy cow!"

Muckerman: Yeah, they're the size of a hub of a lawn mower.

Moser: Yeah, it's like a glorified Roomba. You don't need to negotiate with them, you just tell them what to do and they do it. And whether it's warehouses, or, one day it's going to be cars, one day it's going to be trains, whatever it is, this is going to be a monumental shift over the rest of our lifetime, seeing how this plays out, and seeing how it changes the focus of our economy. I think we're more and more becoming an extremely service-based economy where most of the jobs out there are in the service industry. And that's not necessarily where everyone wants to be, because really, the differentiator there is being able to provide exceptional service on a day to day basis, and that's really hard to do.

Muckerman: Yeah. You mentioned companies making calls. One person in particular might have been making a few calls, and that's Bill Gates. He's the largest shareholder of CN Rail, following in the footsteps of his buddy Warren Buffett getting into the rail business. Earlier this month, the government of Canada allowed up to 25% individual ownership. At first it was capped at 15% of the national railways there, CP Rail included. So now, if he wants to tick up from the 13.5% he's at now, maybe he drives it up a little higher.

Hill: And this is a stock that's done well, particularly if you look over the last couple of years. CNR has done a nice job of rewarding shareholders.

Muckerman: Long-time Stock Advisor rec, it was one of the first Stock Advisor Canada recs we ever made, doing very well. CP Rail is up for the same deal at the end of 2017 with the same union. We'll see if they wait until the eleventh hour in December.

Moser: Here's a thought. You talk about the rise of machines all the time. I mean, I think there's some legitimacy to that, Chris, I hold your same fears to a certain degree. What's to say that the makers and programmers of these robots that will one day take over our entire economy, go in there and program a, "Every two years, you're going to stop working." So, instead of going in there and saying, we want to negotiate new terms or we're going to go on strike or whatever, what's to say the programmer can't just go in there and make that sort of happen on their own? It's going to happen regardless, it's going to be happening from one part of the transaction or another. So, I don't know. You have to at least think about it.

Muckerman: The computer scientists go on strike.

Moser: Exactly. It's a strike by proxy, right? It seems like it could actually be plausible.

Hill: That's part of the investing equation that I think a lot of people are taking for granted. There's this assumption that once these railroads are autonomous and you just have machines driving them, then they don't have to pay these 3,000 conductors, and then automatically their costs will go down and their gross margins go up. First of all, if I'm one of these other companies that's working with CNI, and they get to that point somewhere in the future, I think I'm picking up the phone and saying --

Muckerman: You're recouping some costs.

Hill: -- I see your costs are going down, what about my bill?