One idea I read on Reddit is to only let people borrow against their cost basis, rather than the gains. If you want to borrow more, you're forced to sell your stock.
Alternatively, you could continue to allow them to borrow against the current price of the stock, but doing so causes gains to become realized for the sake of tax purposes.
If you want to be especially charitable, allow the stock owner to choose which of the two options to use when applying for the loan.
If you want to be especially charitable, allow the stock owner to choose which of the two options to use when applying for the loan.