Cash has rarely been this hot on Wall Street. Financial advisers warn holding too much can burn a hole in your portfolio. With markets rocky and cash earning 5% or more, investors have boosted their holdings of money-market funds to a near-record $5.6 trillion, according to the Investment Company Institute. Both individuals and institutional investors are piling in—asset managers now have roughly one-fifth of their portfolios in money-market funds, State Street data show. Cash was trash for years on Wall Street, where low interest rates left investors buying every dip, saying there was no alternative to stocks. The prospect of a prolonged period of higher rates has upended that thinking, buffeting both stocks and bonds while increasing the returns offered by some of the safest, shortest-term investments such as money markets. Yields fluctuate with benchmark rates set by the Federal Reserve. Though considered to be among the safest of all investments, deposits in the funds aren’t insured and they have occasionally gone haywire in times of stress. The Fed’s most aggressive interest-rate campaign in decades has lifted rates near the returns many investors would expect from their portfolio on an average year. With the central bank expected to hold rates near this level for some time, money-market funds are now considered a viable investment rather than just a place to stuff cash. Fees are also relatively high. Investors pay annual expenses based on how much they have invested in a fund. Many large money-market funds charge 0.5% a year in fees, if not more, to support upkeep including administration, trading costs and employee salaries. Taxes are another consideration, and often a big one. Interest payments on money-market funds are generally taxed as ordinary income, not at dividend or capital-gain rates. How the income is taxed at the federal or state level will depend on the investments a fund holds. Interest from U.S. Treasury debt, for example, is taxable at the federal level, but not for states.