corporate share pledging as a tax avoidance strategy


My confusion with corporate pledging as a tax avoidance strategy is illustrated with the following example:

Let’s say Elon Musk takes out a personal loan of USD 100M against 10 Billion dollars in Tesla stock as collateral. There is an interest rate at 2%, and the loan is for one year.

My confusion: when Elon Musk pays off the loan, does he just “give” the bank the amount of unrealized tesla stock currently worth the principal + interest?

Or, rather does he have to sell stock in order to pay off the loan? The reason why I am confused is that if he has to sell the stock to pay off the loan, doesn’t he also pay capital gains taxes on the stock sale? How would he be “avoiding” taxes?

Can someone how Musk could engage in corporate pledging in order to lower the amount of taxes he pays?

In: 1

In a year he refinances the loan, deferring the gain until death. At death, the basis on the stock is stepped up. Meanwhile, he takes the loan through an LLC and the interest is tax deductible.