They're back!

Investors piled billions of dollars into specialized commodities funds in the first quarter after going cold on the sector last year, according to new data.

Such funds include the SPDR Gold Shares (GLD - Get Report) ETF, which owns bars of solid bullion, as well as many others including the United States Oil (USO - Get Report) which tracks the price of crude oil.

The sudden switch in sentiment comes amid increased chances of a U.S.-China trade deal, expectations of rising inflation and the perceived need by some investors to diversify away from stocks, analysts say.

"Investment flows of $14.7 billion contributed to the rise in AUM [assets under management] amid positive sentiment towards risk assets," states a recent report from British Bank Barclays. "This reversed most of the losses in AUM during Q4 [the fourth quarter last year], when investors withdrew funds as prices collapsed."

The $14.7 billion inflow of cash during the first three months compares to near-zero ($0.4 billion) for the whole of 2018.

The dominant share of this year's new cash went to energy funds ($5.5 billion) closely followed by agriculture-focused funds ($4.2 billion.) The remainder went into precious metals and industrial metals funds.

If the torrent continues at the same pace through year-end, then such funds could be expected to take in close to $60 billion, or almost as much as the $68.4 billion that Barclays says got added to commodities funds in 2016. A total of $30.9 billion in new cash was committed to such funds in 2017.

U.S.-China Trade Deal?

Optimism over the U.S. and China cutting a mutually acceptable trade deal is no doubt getting some investors excited about the sector.

"This is the time where this deal can happen," says Don Coxe, chairman of Chicago-base Coxe Advisors. He notes that the Chinese government has likely been waiting to see if President Donald Trump would get ousted as a result of the Mueller investigation. But now that the investigation is over, Beijing will assume that Trump will stay in office for at least the next two years and will now waste little time in getting a deal done, Coxe says.

Meanwhile, Trump is surrounded by people who favor free trade, including Larry Kudlow, Director of the National Economic Council.

"Something is going to happen here and that has to be good for virtually all commodities," Coxe says.

China is vitally important to the commodities markets due to its huge appetite for energy, materials and agricultural products. For instance, the country now buys literal boat-loads full of iron-ore and coal from Australia and Brazil to make 49% of all steel produced anywhere, according to the World Steel Association. There are few commodities where China doesn't have an outsized impact.

If a trade deal goes through, it could spark another commodities boom such as the one seen before the financial crisis.

Need to Diversify

At least some of the renewed interest in the sector is also due to worries about inflated stock values.

"I think that the stock market is getting to a point where funds are trying to diversify more," says Jim Roemer, president consulting firm Best Weather Inc., which advises commodities dealers among many other things.

Stocks are historically pricey relative to earnings per share and some investors are likely looking to shift some money to other asset classes including commodities. The cyclically adjusted price-earnings ratio (the so-called CAPE) for the S&P 500 index, which measures the price of stocks versus their income, is now at 31.6. That's a historically high level exceeded only during the dot-com bubble of the late 1990s early 2000s, according to data from multipl.com. Typically, annual stock returns are lower following periods of high CAPE readings.

Wealth-Withering Inflation Coming

Another part of the sudden love affair with materials and foodstuffs is the prospect of increased inflation.

"We think investors are appropriately reacting to inflation signals," says Darius Dale, co-head of macro strategy at risk management firm Hedgeye in Stamford Connecticut.

Dale says the U.S. economy has transitioned from a period of declining inflation and slowing economic growth to one where the growth remains slow, but inflation is rising.

He says the Federal Reserve is accelerating that reinflation process through its dovish policies. In the last year, the Fed reversed its stance from one where increases in interest rates were a near-certainty to the current outlook where rate hikes are more-or-less out of the question.

That stance is leading investors to worry about wealth-withering inflation coming to the economy. It makes sense in such an environment for investors to pile into commodities because they tend to outperform other assets during periods of elevated inflation.

Constable owns none of the securities listed in this story.