Like most other businesses, railroads struggled during Q2. Aside from the logistical challenges stemming from coronavirus-related shutdowns, consumer spending cratered. The need to deliver goods from any point A to any point B in the country plunged.

That began to change in June, and the recovery has accelerated in a big way this quarter. The recovery hasn't been an even one, though. It's favoring certain railroad lines -- and especially Union Pacific (NYSE:UNP) -- for two lucky reasons.

Rising tide

Railroad investors don't need to be reminded that Q2 was a disaster. Union Pacific's top line tumbled 24%. Canadian Pacific (NYSE:CP) reported a 9% year-over-year revenue decline, leading to a 5% dip in per-share earnings. CSX's (NASDAQ:CSX) top line fell by 26%, with operating income down 37% year over year. COVID-19 simply took a toll.

Intermodal containers on a flatbed train car

Image source: Getty Images.

That weakness is in the rear view mirror now, assuming a new coronavirus flareup doesn't bring the world to another screeching halt.

That's the gist of the message delivered by several railroad executives at Cowen's Global Transportation Conference held earlier this month. Among them was Union Pacific's CEO Lance Fritz, who explained, "Demand is at or near peak-season levels." Cowen's analysts aggregated all the conference panelists' observations and similarly concluded, "Freight fundamentals across all modes are strong, with retail and CPG (consumer packaged goods) restocking of inventories a major driver of the current spike in demand."

West Coast intermodal traffic surging

The rail traffic recovery hasn't been uniform from coast to coast. It's concentrated on the West Coast, and intermodal shipping is doing most of the heavy lifting. Both trends play into the hand Union Pacific is holding.

Intermodal containers are the 20, 40, and 53-foot (the same length as a tractor trailer) metal boxes you'll sometimes see stacked on the deck of a cargo ship, being ferried around by a semi, or sitting on top of a flatbed railcar. For consumer goods, this delivery approach allows for the packing of an entire container at a manufacturing site and unloading at the end buyer's site; logistics companies simply haul the whole box rather than handling each crate inside it.

The Association of American Railroads indicates intermodal loads have been above 2019's levels for most of the past six weeks. Fritz further noted at the Cowen conference that Union Pacific's quarter-to-date intermodal traffic was up 8%. CSX executive Mark Wallace said intermodal volume was up 6% quarter to date.

This strong demand for intermodal shipping makes sense. Shortages of various consumer goods are driving the restocking that Fritz alluded to several times during Cowen's conference. The resulting surge in demand for access to Union Pacific-owned intermodal containers drove a 40% increase in rental spot prices during June, sparking a series of added surcharges on most West Coast rail shippers that railroads in other parts of the country can't command. By last month, the carrier was charging an extra $500 per container to most West Coast shippers using more than their contracted allotments. Some shippers face even bigger surcharges from Union Pacific. Small shippers in Los Angeles, for instance, are paying $3,500 or more on top of the normal cost of using its rail lines to deliver goods.

For perspective, Union Pacific has recently been collecting between $1,200 and $1,300 of revenue for each intermodal container it handles. And like many rail names, intermodal accounts for about one-fifth of Union Pacific's revenue.

This supply-demand dynamic is largely limited to the West Coast -- where Union Pacific is a powerhouse -- as that's where most consumer goods made in eastern Asia make their way into the United States. Months of backed-up demand is now being unleashed, leading to record-breaking prices for container rentals, mirrored by record-breaking traffic in August for the Port of Long Beach and the Port of Los Angeles.

All those goods have to go somewhere. Union Pacific can almost name its price.

Bottom line

Don't misread the message. More rail traffic is good news for railroads across the country. Union Pacific's rivals are adjusting too, particularly to the surge in intermodal demand. In June, for instance, BNSF opened up a new intermodal delivery route between Seattle and a CSX terminal in Ohio.

The West Coast's congestion and high pricing is also likely to accelerate the expansion of alternatives. Canadian Pacific added intermodal service between the East Coast port of St. John and Montreal last month, and CSX continues to work on two new intermodal terminals in North Carolina and Ohio. Additionally, Canadian Pacific and maritime shipper Maersk recently agreed to build and co-operate a major intermodal facility in Vancouver. The advent of these and other shipping routes will shave off some of Union Pacific's pricing power, but before then, the end of the restocking wave will also curb some of the aforementioned surcharges Union Pacific has been able to impose.

At least for this year's third and fourth quarter reports, though, Union Pacific's unique geography and its eight intermodal terminals peppered across the country set the stage for strong results.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.