Quibble on stocks: as with other asset classes, they are highly sensitive to the quantity of money and availability of credit, so they're not insensitive to inflation. Though they are generally positively affected by increases in the money supply: see QE and US stock market respose.
Few people hold all their wealth in banknotes, and none of them are rich. The rich invest their wealth in companies and assets that appreciate much faster than inflation.
Real estate is wealth but inflation doesn't decrease its value. Stocks are wealth but inflation doesn't decrease their value.