You avoid taxes by not getting cash in a tax inefficient way (income, capital gains) and instead you get it in loans (which can be tax deductible!)
Then when an event happens that allows you to pull cash efficiently (capital losses, inheritance asset step up etc) you service the loan.
Your lender is happy to do this both because the loans are fully backed by real assets and they want to sell you or your businesses other services.
$5 million, to someone that rich, is like $50 dollars to us. It's chump change you might find laying around your house.
It can also unwind just as quickly if you need to pay those debts back in a hurry, causing your asset prices to tumble on the way down. But if you're big and have borrowed enough money, whole jobs and industries will be dependent on your continued solvency, and so you can sometimes maneuver to put the public on the hook.