Too late to edit my comment, but one other thing:

>The stocks get a one-time relief from capital gains as it moves to the heir. This gives opportunity for the heirs (or the estate) to sell the stocks to pay back the loan. That is the loophole.

Yes, this step-up in basis happens because the estate is charged estate tax. Charging capital gains AND estate tax doesn't make sense, estate tax is typically higher than capital gains tax.

This is a key piece a lot of people don't understand.

> Charging capital gains AND estate tax doesn't make sense, estate tax is typically higher than capital gains tax.

They should be multiplicative. Everyone is supposed to pay capital gains. And everyone is supposed to pay the estate tax. They're both percentage taxes. It's not supposed to be "pick one".

>They should be multiplicative.

That doesn't make any sense.

>Everyone is supposed to pay capital gains.

Not true. You don't pay if you have capital losses, nor do you pay if you have capital gains in tax sheltered accounts, etc.

>They're both percentage taxes.

No one claimed otherwise.

>It's not supposed to be "pick one".

That's exactly how it is in many cases, even income taxes have been that way for decades (though SALT deduction now limited). Read up on double taxation and why it's typically avoided.