In this month's Econlib Feature Article, which posted a few minutes ago, Robert Murphy lays out the basics of the stock market. A key paragraph:
Despite its importance, the stock market remains a bit of a mystery, even to many otherwise staunch champions of the free market. People who have no problem defending the actions of advertising executives or payday lenders, often fall short of defending the stock speculator or "corporate raider." Yet these popular villains actually perform vital services, and government policies against "hostile takeovers" actually make us poorer.
Also, Murphy writes:
One popular complaint about the stock market is that it fails to channel savings into productive investment. According to this thinking, someone who takes $1,000 out of his paycheck to buy shares of Acme stock doesn't really "invest in" Acme, but rather transfers cash to a prior holder of Acme stock. The corporation doesn't get its hands on this $1,000; it's not available for Acme to expand its factories or hire new talent.
Also, for more on how the government prevents companies from being sold to those who would likely run them better, often by kicking out incumbent management, read Jonathan Macey's "The Market for Corporate Control" in The Concise Encyclopedia of Economics. One of the biggest obstacles is the Williams Act, named for U.S. Senator Harrison Williams, D-NJ, who later went to prison for taking bribes.