NEW YORK -- Suddenly, cash is king again.

For years, cash languished at the bottom of the investment rankings, weighed down by nearly non-existent interest rates. But with the Federal Reserve raising short-term rates four times last year, money-market funds and online savings accounts began paying interest that came close to approaching inflation.

This while stocks, bond funds and gold all posted losses in 2018.

"It took us a while to get above zero," said Deborah Cunningham, chief investment officer of global money markets at Federated Investors. "But now that we're in a slow-growth environment with interest rates normalized, it becomes a pretty good place to exist."

Investors now can find rates of 2 percent or higher while hiding out in cash, and that 2 percent looks even better when compared with the whiplash-inducing ride that stocks forced investors to endure last year. S&P 500 index funds lost more than 4 percent in their worst showing in a decade, but they also dragged investors through more than a dozen days where they lost more than 2 percent on the way there.

The steady-and-not-so-slow-anymore returns for cash, plus expectations for even more market volatility in 2019, means strategists along Wall Street are seeing cash as a viable investment option for the first time in years.

Some investors have peeled off a portion of the big profits made from stocks in recent years and plugged it into cash in hopes of preserving it. Others, meanwhile, have pulled back from the riskier bonds they bought in search of higher income when rates were at record lows, moving back into money-market funds, certificates of deposit and online savings accounts.

Nearly $90 billion went into money-market funds during the first 11 months of last year, according to the Investment Company Institute. They were more popular than bond funds, which attracted a net $67 billion, and much more so than stock funds, which saw $171 billion head for the exits.

But before jumping back into the safe embrace of cash, it's key to remember that this may be close to as good as it gets.

The Federal Reserve has indicated it may slow its pace of interest-rate increases this year, with perhaps two more in 2019, which would cap the increase in returns that cash provides. The Fed raised rates a total of seven times in the prior two years. Some analysts even expect the central bank could make zero moves this year as fears rise about slowing economic growth around the world.

And while the steadiness of cash can be a comfort when markets are heaving, it has its own risks.

The biggest risk is being too conservative. An investor planning to retire decades in the future would likely get much, much higher returns from stocks than cash, which is only just starting to match the rate of inflation. Even bonds, which carry the risk of falling prices if interest rates rise, would likely return more because they have higher yields.

But the fact that investors are even pondering such questions, after years of not even considering the non-existent returns of cash, shows how much the market has changed.

"It's a good feeling to have inflows, higher rates and good returns," said Cunningham, whose suite of funds includes the $75 billion Federated Government Obligations fund, which returned 1.7 percent last year versus 0.3 percent in 2016. "It's much more pleasant than having to explain why this and why that."