The world's second richest man, Warren Buffett, is buying himself an enormous train set by acquiring one of America's largest freight railway operators, Burlington Northern Santa Fe, in a deal worth $44bn (£27bn) that signals confidence in a long-term revival of the US economy.

Buffett's Berkshire Hathaway investment empire, which has been dabbling in railway stock for several years, already owns 22% of the Texas-based goods rail network. It is paying $26bn in cash and stock to buy the rest, valuing the entire business at $34bn, and will take on $10bn of debt.

The purchase is the biggest in the history of Berkshire Hathaway, a Nebraska-based conglomerate built on insurance that has expanded to own businesses such as Fruit of the Loom and MidAmerican Energy, the parent company of Britain's Northern Electric and Yorkshire Electricity.

Buffett made a $100-a-share offer to BNSF during a recent visit to the railway company's home city of Fort Worth and he said its board accepted in "about 15 minutes". The billionaire, whose wealth ranks second only to Microsoft's founder Bill Gates, said he believed that rail offered both environmental and cost advantages over road.

"It's a very efficient way of moving goods," said Buffett. "I just believe this country will prosper, that you'll have more people moving more goods 20 or 30 years from now, and that the railways will prosper."

BNSF employs 40,000 people and runs 6,700 locomotives along 32,000 route miles stretching from Texas as far afield as California, Seattle and Chicago. It transports coal, agricultural products, consumer goods and industrial materials between US cities and to or from international ports, competing with freight haulage on the roads by trucks.

Speaking on CNBC television, Buffett said that one gallon of diesel fuel can haul a ton of goods for 470 miles on the railways. "They do it in a very cost efficient way and they do it in an extraordinarily environmentally friendly way," he said.

Matthew Rose, BNSF's chief executive, said the railway company believed its future would be supported by a "three- legged stool" of carbon pricing, high fuel prices and traffic congestion, all of which were likely to encourage a search for alternatives to road transport.

Known as the "sage of Omaha", Buffett has a vast following among investors and draws tens of thousands of people to his annual meetings in Nebraska, known as the yearly Woodstock for capitalists. His words are closely followed by the investment community. Since the financial crisis began, Buffett has made substantial investments in Goldman Sachs and General Electric, boosting confidence in both companies but he has also made some rare slip-ups – several banking investments went awry and Berkshire Hathaway lost its triple-A credit rating.