Railroads, as the transporters of much of what a country imports, exports, and consumes, are cyclical stocks that tend to move up and down with the overall health of the economy. So perhaps it's no surprise that it's been a good decade for the U.S. industry, coming off recession lows, with Union Pacific (NYSE: UNP) up more than 270% since the beginning of 2008 and CSX (NASDAQ: CSX) not far behind with a 255% gain. A 1950s-era Union Pacific E-9 locomotive and train. Image source: Union Pacific. The other major North American railroads, a group that includes Norfolk Southern (NYSE: NSC), Kansas City Southern (NYSE: KSU), Canadian National (NYSE: CNI), and Canadian Pacific (NYSE: CP), are each up more than 150% during that time. And Berkshire Hathaway has benefited from rail as well, using growth in its wholly owned BNSF Railway Co., among other industrial assets, to offset insurance losses in the most recent quarter. Railroads also tend to be tied to moves in energy prices, a factor that for a while tempered enthusiasm for the sector. While lower energy prices do offer fuel savings, railroads are usually the most efficient form of surface transportation and are better able to compete against truckers when fuel prices are high. Name Market Cap (in Billions) TTM P/E Ratio TTM P/S Ratio Dividend Yield Union Pacific $92.25 21.25 4.45 2.01% Norfolk Southern $36.84 20.92 3.60 1.86% CSX $45.56 26.28 3.93 1.48% Kansas City Southern $10.92 21.22 4.42 1.25% Canadian National $60.59 20.44 6.06 1.52% Canadian Pacific $25.58 17.34 5.58 1.00% Data source: Yahoo! Finance. The four large publicly traded U.S. railroads currently all trade at valuations considerably higher than their 2009 lows. Given the nice run-up and cyclical nature of these stocks, it's a good time to be selective. Here are two good buys and one better to avoid if you want the railroads to deliver oversize returns. Roll with the best Union Pacific, is one of the great names in American commerce. The stock isn't cheap, but it remains a best-of-breed company that should fight for a place in any diversified, long-term portfolio. The company operates a 32,100-mile route network covering 23 states spread across the western two-thirds of the United States, operating as a duopoly along with Berkshire-owned BNSF throughout the West with access to major Western ports as well as the Gulf region, giving the company massive exposure to trade markets.Its Western roots provide other advantages over its Eastern rivals, including longer stage lengths that typically allow for more efficient operations. Union Pacific has also done a lot of heavy lifting in bringing down costs. Its operating ratio, a measure of operating expenses divided by operating revenue, fell to a record low of 61.8% earlier this year, compared with 87.5% in 2004. Earnings per share have climbed from $0.71 to $5.07 during that period, and return on invested capital has gone from 5.3% to 12.7%. Investors in Union Pacific get that quality network and the most attractive dividend yield in the industry, currently standing at 2.01%. Between 2013 and 2016 the company has returned more than $19 billion to shareholders in the form of buybacks and dividends. There are potential headwinds, though. Union Pacific carried more than $15 billion in debt at year's end, up from $9.5 billion at the end of 2013. Most of it doesn't mature until after 2021 and poses no immediate concerns, but it will have to be paid down over time. And since that borrowing has helped fuel the share repurchases, it suggests that the pace of buybacks could eventually slow. Intermodal, at 20% of total 2016 revenue, was the company's largest individual segment, with agriculture, industrial products, and chemicals each carrying nearly the same weight in the portfolio and both coal and autos representing between 10% and 15% of revenue. Union Pacific is well positioned to benefit during good times and weather the bad. A bet on NAFTA Kansas City Southern has been the least loved among major North American railroads this year, in large part because of a business that was once considered its crown jewel. KSU over the past two decades has built an expansive network connecting the U.S. heartland to Mexico -- including a terminus at the Pacific port of Lazaro Cardenas -- branding itself as "The NAFTA Railroad" in a campaign last decade and in years past, typically earning the company a premium valuation. The outlook for NAFTA -- and with it the outlook for KSU -- remains very much in doubt, but despite White House rhetoric to the contrary there is at least hope that with so many business connections between Mexico and the United States the get-tough talk will be worse than any actual changes. If so, Kansas City Southern would likely enjoy a nice pop from relieved investors and the advantages of its 6,000-mile north/south network would once again be appreciated. KSU is also the only major railroad with at least some chance of being a takeover target. The U.S. Surface Transportation Board (STB) since the turn of the century has discouraged further consolidation among so-called Class I -- or major -- railroads after a previous round caused massive delays in cargo shipments and reduced the country to two major railroads on each coast. Kansas City Southern is both a major railroad, and separate from the duopoly operating on each coast, and some analysts have argued that the STB could look favorably on the right buyout of the company. One of the Canadian giants, for example, could add KSU to its network and arguably increase overall U.S. competition instead of further increasing concentration. That's more of a long shot than it is an investment thesis, but the company is alone among the large U.S. railroads to at least offer the chance of a buyout. Beware of the turnaround sequel Shares of CSX jumped more than 20% last January, after word leaked that activist fund Mantle Ridge would attempt to replicate the turnaround Bill Ackman's Pershing Square Capital Management spearheaded at Canadian Pacific. CSX's stock eventually hit an all-time high as part of the excitement. Part of the CSX playbook was recruiting 72-year-old Hunter Harrison, the architect of the CP turnaround, to run the U.S. railroad. Harrison was named CEO of CSX in March. CSX freight train in Washington, D.C. Image source: National Transportation Safety Board, via Flickr. It's still early in the process, but so far the big winners were the existing CSX investors who took their gains as soon as the activists got involved. So far Harrison's playbook of slashing costs and streamlining operations has at least initially led to service delays and added rail congestion. The STB, the industry's regulator, in September held a public session to hear complaints from shippers about CSX service disruptions. CSX tends to run shorter routes through more congested, urban areas compared to its Western and Canadian Peers, making streamlining a more complicated proposition. The company, thanks to the stock run-up, is also by some measures the most expensive in the sector. Add in that Harrison has had health issues and the faith that the turnaround will be completed and the valuation will be justified must be brought into question. CSX, a hodgepodge of dozens of railroads consolidated over a three-decade span, culminating with the disastrous 1999 takeover of Conrail, certainly has considerable costs to trim and efficiencies to be extracted. But previous efforts to do so have ended up as quagmires. There's no compelling reason to be confident this time will be any different. 10 stocks we like better than Union PacificWhen 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 Union Pacific 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 November 6, 2017Lou Whiteman has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Berkshire Hathaway (B shares) and Canadian National Railway. The Motley Fool recommends CSX. The Motley Fool has a disclosure policy.