Those are typically around the rates of a HELOC, so its a low-cost way to get money, especially free money from your company. Obviously, the more money is in the 401k, the larger the loan could be to pay off high-cost debt.
That being said, if you were knowledgeable enough to know this and pull it off, chances are you wouldn't be in such a financial predicament, so it probably doesn't apply to most. Its fascinating how much of this is psychological, and thus not subject to rational counterarguments. Like, all the good reasoning in the world isn't enough sometimes to get people out of debt. It has to be an almost visceral, non-thinking reaction to get them to a place of financial stability.