When you buy shares in a company you are investing in it and providing the company with capital.
This effect is the ultimate outcome of a long chain of reactions that originates with the exchange of your money for the seller's stock. If you had spent your surplus income buying consumer goods instead of the stock, that chain of reactions—and the outcome of new capital they produce—wouldn't have happened.