Rises in the price of goods and services, is known as inflation. Inflation erodes the value of your money. For example, $100 in the future may not buy the same amount of goods as $100 today. To prevent the value of your money being eroded, your investments need to earn a return equal to or above the rate of inflation in the long-run.
For your investments to more than keep pace with inflation, you need to invest in assets which are expected to deliver higher returns in the long-run (like property or shares).
The following graph shows how an investment of $100 in the Australian share market in 1900 would have grown in "real" or after inflation terms. By the end of 2008, this $100 would have grown to $208,059 in real terms. Cash on the other hand would only have grown to $207 - a significantly lower return in real dollars.

There were many periods in history where cash did not keep up with inflation. Eg during World War I and II, post World War II and the 1970s. Of course there were also times when the share market did not keep up with inflation, however the returns in the long-run have significantly compensated.