Recently, FORTUNE sent me to Omaha to write this story about the Union Pacific, America’s biggest railroad. Impressive company in a fascinating industry without which our lives would be very different. Here’s how the story begins:

The strawberries on your cereal. Your laptop, cell phone, and TV. The coal that’s burned to power them. The car you drive. The roof over your head. We may work in a knowledge economy, but Madonna had it right: We live in a material world.

That’s why the Union Pacific railroad, No. 164 on the Fortune 500, has played a vital role in the U.S. economy since 1862. With $14.1 billion in revenue last year, the UP, which is based in Omaha, is America’s largest railroad. Close behind is its chief rival, the Burlington Northern Santa Fe (BNI) (2009 revenues: $14 billion), headquartered in Fort Worth, which was acquired this year by Warren Buffett’s Berkshire Hathaway (BRK.A) for $26.4 billion. The deal put a spotlight on the often troubled railroad business — in a good way. “It was a vote of confidence in the industry,” says Jim Young, the 53-year-old chairman and CEO of Union Pacific. “He sees the long-term value in the rail franchise — how unique it is in America.”

The story goes on to talk about how Young led a turnaround at the railroad, which suffered from lousy service, not once but twice–in the late 1990s after its merger with the Southern Pacific and again in 2004-2005 when the company cut back too deeply on equipment and staff and wasn’t prepared for a burst of economic growth. As Young told me: “We were the best marketing arm of our competitor.” The UP’s competitors include the Burlington Northern, which also operates in the west, and, interestingly, long-haul trucks.

In its battle for market share with trucks, the railroad industry is touting its environmental advantages. They are real. While my FORTUNE story didn’t get into much depth on the topic,  Young and his colleagues spent a fair amount of time telling my why the UP is an environmentally-friendly way of moving goods around the country. On its website, under the headline A Green Railroad, the company says:

Did you know that railroads are one of the most environmentally friendly modes of freight transportation? It’s true. Freight trains are almost four times more fuel-efficient than over-the-road trucks and have less impact on greenhouse gas emissions than trucks.

The UP has gone to great lengths to cut down on its fuel use, as I reported in the magazine:

The Union Pacific has also become more efficient. Trains are longer — on average, 5,800 feet, or more than a mile long — and instead of just pulling the freight cars, locomotives are distributed throughout the trains so that they push as well. Information technology helps too: Locomotives with GPS track the fuel efficiency of every engineer, and those who use the least fuel get a share of the savings, between $200 and $400 a month.

That has enabled the Union Pacific, with the rest of the railroad industry, to tell a nice-sounding environmental story: The rail industry as a whole carries about 43% of all freight (as measured in ton-miles), but trains consume just 7% of the energy used to move freight. Trucks, by contrast, move 31% of the tonnage but use 66% of the energy. UPS,  a big customer of Union Pacific, uses trains rather than trucks to move ground packages that travel 750 miles or more. “The economies of steel on steel are better than rubber on concrete,” says Kelley Anderson, general manager for rail at UPS.

union-pacificlogoThere’s much more to UP’s greening. The locomotive in the photo at the top of this blog, known as a Genset, was designed by the railroad for use at its yards. Mike Iden, UP’s director of freight car and locomotive engineering, who has led many of the efficiency efforts told me: “It’s an ultra low emitting yard-switching locomotive.” It’s based on technology developed by the U.S. Department of Energy to improve diesel truck emissions.

So what’s wrong with this green story? Well, the UP carries a lot of coal, America’s dirtiest fuel–as much as 10% of the coal burned by utilities, by one estimate. You can’t really blame the railroad for this–no company can be expected to turn away its most important customer.

But the Union Pacific also has opposed legislation to cap greenhouse gas emissions and put a price on carbon. This is interesting because anything that raises the cost of fossil fuels will give the railroad a competitive advantage over less efficient trucks. So that’s the problem with the climate change bills, I asked Young. He told me he was worried about the effect of the legislation on coal, the economy and jobs:

I’m concerned about what it means to coal, long-term, and what it could do to the cost of electricity in America, and moving jobs offshore.

The Midwest has some of the lowest costs of power in America. Google built a new data center right over here on the Missouri River. They did it because the cost of power is so low.

Coal’s got to be part of the energy equation, long term…The cost of the renewables? You’ve seen the math.

Well, yes, I’ve seen the math and the EPA estimates that the Senate legislation to regulate carbon emissions would cost an average family about $79 to $146 a year. This seems like a reasonable price to pay to offset the potential costs of global warming. Young obviously disagrees, as do many people in the coal-dependent heartland. Which is why it’s so hard to get Washington to act on climate change.