That's not accurate. It has several benefits (like interest payments being deductible expenses) and wealthy people can continuously borrow to pay off other debts as their other assets appreciate. You just need the rate of appreciation of your assets to be higher than the interest rate. For very big loans, it's quite possible.
Finally, it's also possible to roll the gains into a trust and the cost basis is adjusted to zero on death. [0] So yes, it's tax avoidance.
[0]: E.g. this is how it's possible to do that: https://wellergroupllc.com/taxes-resources/tax140-guide-dete...