John Bogle, founder of Vanguard and renowned investor, seems to disagree with you: "The stock market has nothing—n-o-t-h-i-n-g—to do with the allocation of capital. All it means is that if you’re buying General Motors stock, say, someone else is selling it to you. Capital isn’t allocated—the ownership just changes. I may be an investor, you may be a speculator. But no capital goes anywhere. This is basically a closed system. You have new IPOs and whatnot, but they’re very small compared to this vast thing we call a market, which is now around $24 trillion. The allocation of capital? That’s just nonsense."
I think you are mixing up the concept of a market economy with a specific kind of market, the "stock" market.