The higher ratings also will help the railroads battle a slump in coal shipments, which is hurting their revenue, by freeing up funds to rejigger terminals to handle more shale and oil-related shipments.

Ratings agencies recently upgraded Union Pacific Corp, the largest publicly traded U.S. railroad, and Kansas City Southern Corp, the smallest. No. 2 U.S. railroad CSX Corp's had its outlook revised to positive, signaling a possible upgrade.

All of the railroads but Kansas City Southern are investment-grade credits, and ratings are rising gradually within that category, while Kansas City Southern is now just one notch away from achieving that status.

The biggest railroads are huge debt issuers with each having more than $8 billion outstanding.

Higher ratings can save railroads tens of millions of dollars each over the life of a typical note offering.

Borrowing is also getting cheaper as global financial market turmoil drives investors to safe U.S. government debt, which pushes down interest rates.

That's promising for companies like Union Pacific, which plans this year to spend a record $3.6 billion, 13 percent more than last year, on new terminals and network upgrades.

In total, the five largest U.S. railroads are looking to spend at least $12 billion this year on updates to the nation's 140,000-mile track network, installing required technology and opening terminals to help draw traffic from more expensive and congested highways.

Union Pacific, which Standard & Poor's upgraded in April by one notch to A- from BBB+, took advantage last week by selling $600 million of notes evenly split between 10-1/2- and 30-year debt, and cut more than half a percentage point off the interest rate it paid compared with its last 30-year sale in August.

That lower rate on a $300 million deal saves more than $40 million over the life of the note, based on analysts' estimates.

"Clearly your financial flexibility improves the higher your rating is," said Philip Adams, senior bond analyst at Gimme Credit in Chicago. "If you're capital intensive and you have continuous needs, it's even more important."

Norfolk Southern Corp most recently sold $600 million of 10-year debt in March, part of its plan to finance construction of four new intermodal terminals along what it calls its "Crescent Corridor" of railroad stretching from New Orleans to Albany, New York.

The company, rated BBB+ by S&P and a comparable Baa1 by Moody's Investors Service, plans on spending about $2.4 billion this year on network upgrades and expansion.

"We have been cramming more and more Crescent business into our existing terminals," Chief Executive Wick Moorman said at a recent investor conference. "It's going to allow us to continue the growth trajectory that we have been seeing in the past few years."

Intermodal shipping takes goods from appliances to auto parts in containers from one mode of transport to another, such as ship to rail. It is a rising share of U.S. railroad shipments, which reached 1.9 billion tons in 2011, according to the Association of American Railroads.

KEEPING FLEXIBLE

Better earnings and operating efficiency are behind the trend toward improved ratings, the ratings agencies say, noting that many companies were able to cut costs and raise prices to customers. Price competition among the railroads and from trucking companies, and the capital intensity of the rail industry temper these strengths.

S&P's April upgrade of Union Pacific to A-, the highest of any U.S. railroad operator, brought it to match its Canadian National Railway long-term rating.

Canadian National is considered the most efficient railway, based on operating ratios, analysts said.

Among outstanding issues, Union Pacific notes due 2021 ended May yielding about 1.4 percentage points above similar maturity Treasuries, about half a percentage point more than comparable Canadian National bonds.

On a $500 million issue, that half a percentage point means a $25 million pre-tax savings over the life of a 10-year note, Gimme Credit's Adams said. "I don't know anyone that doesn't think 25 million bucks isn't worth saving. It's meaningful."

Moody's rates the Union Pacific two grades lower at Baa2, but in August revised the outlook to positive, which signals a possible upgrade.

TRACK RECORDS IMPROVING

Higher-rated issuers not only pay smaller yield premiums compared with U.S. Treasury securities, but draw investor appetite for much longer maturities.

Kansas City Southern has been paring its debt and retiring notes with double-digit interest rates in a push for high-grade credit ratings like its larger peers to cash in on that trend.

The moves paid off this year with upgrades to just below investment grade.

"Having made the migration to BB+, it's just a little bit of a waiting game with the agencies" to get investment grade, Kansas City Southern Chief Financial Officer Michael Upchurch said at a recent conference. "Instead of doing 10-year maturities, we'd be able to push that out to 30 or 40 years."

The company could then refinance existing debt to potentially cut interest rates by up to 2 percentages points, he said.

One of the biggest issuers, CSX, issued $1.2 billion in 2011 and ended the year with about $8.7 billion long-term debt at a 6.1 percent average interest rate. In February, before S&P revised its outlook to positive in April, CSX sold 30-year debt with a 4.40 percent coupon interest rate, the lowest ever in its ratings category.

"We have the lowest rate of any issuer in the BBB space," Fredrik Eliasson, CSX's chief financial officer, said at a conference. "We're hopeful the credit ratings agencies will catch up to where the market is."

(Reporting by Lynn Adler in New York; Additional reporting by Scott Malone in Boston and Nick Zieminski in New York; Editing by Patricia Kranz and James Dalgleish)

By Lynn Adler