And when the shares are sold, it's taxed as capital gains. You can't eat share price appreciation.
It depends on the company. If you take a dividend payer like MO, they pay a higher yield in dividends than they pay on debt. It would be fiscally irresponsible to retire debt in lieu of buying back shares. The big tech stocks buy back shares in part to prevent share dilution as a result of stock based compensation. There's also irresponsible buybacks, and there's irresponsible dividend payers (see Bell on the TSX), but the market will punish them over the long haul, there's no need to regulate away their decision making.
That's a problem in itself and exactly why it needs to be regulated again, it's not just about will the market punish it or not, it's destructive to companies, over leveraging and attempting to squeeze every bit out and it's next quarters problem x as mentioned were seeing very short CEO tenures compared to the average from the 80s. Short term targets for short term tenures. Buying back over reinvestment, bad for consumers, bad for workers, not everything and every gaurd rail can be centered around if the markets reaction will guide.