Say I'm a rich investor and we meet over brandy and cigars to discuss your business plan.
I invest $100. You spend the $100 to get $200, making $100 in profits. You pay corporate income taxes of $43 (average state plus federal rate) leaving $57 and then pay me that. I pay $17 ($57*30%—federal dividend tax plus medicare tax plus state average) and keep $40.
(It's the same $40 if you liquidate the company and pay me out the money as a capital gain. Also it's the same if you use it to repurchase my equity to cash me out.)
Instead suppose I loan you $100 at 100% interest. You spend the money and make $100 profit, exactly enough to pay my interest and you pay me the money. The profit is entirely tax free for you because of the business interest loophole that exempts 'interest' from taxation. I pay regular income tax of 46% (top federal, Medicare, and typical state rates combined) and keep $54.
Note that the two situations are exactly the same for you. You took my money and earned $100 (after presumably paying yourself) and ended with $100 profit. Then you gave me back the profit. But if I'm a shareholder with skin in the game, I get only $40 back. If I'm a 'passive' investor that just made a loan I get $54. Either way I put the same money at risk and get the same result, but one way the IRS lets me keep 35% more profit because we called it a loan.
But usually we don't know how much profit there's going to be. And sharing profits with multiple rounds of investment is hard with debt. And debt is lousy for profit sharing and stock options.
But if you run a bank, you can underwrite debt contracts that skirt those limits with conditional clauses and preferred liquidations and complicated conditional partial default clauses. And you can arrange convertible debt if necessary. And handle negotiations when conditions change.
Simple loan contracts are much less flexible than equity and usually not sufficient to keep all parties happy and secure. Note that if you try to handle complicated loan contracts yourself without a bank underwriting them, the IRS can reject your definition of a loan and charge you the stock dividend rate and issue heavy penalties. The IRS knows that loans are powerful tax avoision tools and the definition of what is a loan and what is equity is vague and undefined. They will look into your arrangement if it seems too good. If you pay fees to a reputable bank to underwrite, your investment is presumptively a loan and the IRS will never bother you. But if you're not paying protection cash to the banking industry, woe is you.
Companies would prefer to issue stock and let the market handle all those issues more simply, but equity financing means giving 35% of profits straight to the government.
If you issue bonds instead, you can keep the 35% and get you investment capital cheap. All you have to do is pay a few percent of all corporate profits to bankers and issue bonds.
It's a huge subsidy to banks and big old stable corporations with credit ratings. Probably it's worth around half of all US banking profits, tens of billions of dollars annually. (If you take stocks as the baseline, it's worth hundreds of billions.)
And you take advantage of it by keeping very little cash profit and running operations on as much debt as you can use. That allows you to pay out profits as interest. That's why most non-tech companies have little cash.
And it's why companies prefer to pay on corporate bonds rather than issue dividends.