When you put it in your investment account and buy an index fund you would be creating demand for financial assets, and these financial assets companies use to raise capital to expand their business.
If that were true you'd have a stronger case, but when I invest $5k in the stock market I'm not delivering capital to a business so that it can expand, I'm buying dividend rights (shares) from another investor, who presumably bought it from another investor, ad nauseam until at some point in the distant past some investor previously gave capital to a business. Unless you're investing at the IPO or a new stock issue, you're not supplying capital to a business. When you buy from Vanguard et al., you're trading on the secondary market for old shares.
You raise a very interesting argument. But I think you are making an assumption that your $5K investment in stocks will not
--either immediately or eventually--be injected into the real economy; just as your sister would have done. It doesn't have to be a direct investment in an IPO in order to help balance the demand side.
The seller of the stocks you bought might, yes, just reinvest the proceeds; delaying the bulk of the direct effect of your $5K on the real economy. The seller, however, might just as well pay capital gains taxes and spend the remainder immediately.
So your sister wouldn't have paid capital gains taxes, but I think it's inarguable that any tax money given to the government by the seller is pretty much going to be levered up to spend at least the same amount right away; likely more.
The seller's capital gains taxes
* are going to be immediately accounted for, so a portion of your $5K is going right back into the real economy nearly immediately, regardless of the motivation of the seller you bought from.
*I'm not assuming there is no chance of a capital loss incurred by the seller. I am assuming capital gains are more likely, in the aggregate, than capital losses. Furthermore, not all capital losses can be written off in the same year that they are realized. So the government essentially gets an interest-free loan on the future value of any carryover losses, with the added bonus of pricing the principal of that interest free loan in today's dollars. That loan will be repaid with future (presumably inflated) dollars, as the seller writes the losses off; possibly over a period of several years.