The Fed purchases the bonds with cash created out of thin air with a journal entry. That newly created cash is used by private actors to purchase assets, which makes asset prices go up.
The Fed could purchase equities directly, but it doesn't have to own them to influence their prices.