If in cash, they have to get the cash from somewhere, right? Supposedly selling the stocks. That can be taxed then and there.
If they transfer the stocks to the lender, that means the stocks in question are valued at $x, since that's the value of the loan. So tax that value.