The stock market was invented for the purpose of raising initial capital for companies that need it before they can begin trading. Initially this was mainly railways. But now the stock market is rarely used for that (is it ever?) but rather for initial private investors to cash out.
I sometimes wonder if private investment should be illegal. It's completely unfair that billionaires are able to invest early in radical new companies but the general public are not.