Selling the stock locks in the gain. Now, if you only need say 1/2 the value as cash and can absorb the risk of the stock going down, then it makes sense. Or if you want to "buy insurance" by taking out an opposite short position, that would also make sense. But that short position will cost you money too.
So it's not as straightforward as "just take out a loan". You need a very good (and expensive) tax accountant to run the numbers and figure out the best strategy for your situation. Most people can't afford that.