Inflation affects investment negatively, for the most part, but there are significant exceptions. Inflation is an ongoing rise in the cost of goods and services. Stated another way, inflation is the loss of a currency's value — which forces prices to rise in response. The consensus among economists is that inflation is the result of too much money supply chasing too few goods. This basic imbalance forces the price of most commodities higher, meaning that people who have invested in their ownership have a net gain.
Ownership of almost any other type of asset is more problematic because inflation affects investment in different asset classes in various ways. Cash itself can be an investment if one chooses to hold it rather than invest it in other assets. Holding cash as a store of value becomes a bad investment when inflation erodes its purchasing power.
Generally, inflation affects investment in stocks positively because the shrinking value of the currency forces up stocks' prices. That tendency can be complicated however, by the type of business in which a corporation is engaged. Many businesses lose sales when inflation forces them to raise their prices. Other businesses might routinely maintain ownership of inventory or other assets that rise in price because of inflation. So, stocks as a class tend to rise in price because of inflation, but individual stocks are less predictable.
Bonds and other debt instruments have their own inflation dynamics. Investors who loan money receive, along with a note or bond certificate, interest. The more risk that the lender perceives when making such a loan, the more interest the lender will demand. One of those risks is the rate of inflation anticipated over the life of the loan. After money is loaned, inflation affects investment in debt by lowering the purchasing power of the interest earned, and there is no relief to be had by reselling the debt — its value moves down as inflation rises.
Another investment class, precious metals, is often promoted as a hedge against inflation because as a commodity of limited supply, its price should rise as currency loses its value. Although that is true, other factors have an impact. Gold and silver generate no interest or dividends, so in an inflationary environment, they struggle to maintain their desirability compared to stocks.
The major problem in determining how inflation affects investment is in comparing performance by using the shrinking value of the currency being inflated. This creates a kind of double moving target. The solution is to accept that inflation's impact is variable.