401K loans are debts that must be paid back and cannot be discharged in a bankruptcy. In essence, you are borrowing money from your own investments (money you have earned and set aside for retirement).
There is a silver lining to paying back your 401K loans. After receiving the benefit of early withdrawal, a Chapter 13 debtor gets the added benefit of showing the payment of said 401K loans on a bankruptcy petition on both Form 22C (Means Test) and Schedule I (as a mandatory deduction). Some list it on Schedule J as a necessary living expense. Either way, the ability to deduct from monthly income payments on 401K loans has the effect of reducing a debtor's disposable income. In turn, this leaves less money to pay to nonpriority creditors (generally unsecured).
After paying for house, car, food, clothing, utilities, transportation costs, insurances and any other reasonable necessary living expense in a given month, debtor is left with $500 excess. The bankruptcy court in a Chapter 13 through the Chapter 13 trustee will seek to pledge these $500/month to the debtor's bankruptcy plan for 36-60 months. That can be payment to creditors anywhere from $18,000-$30,000.
However, if debtor has a 401K loan (that was taken out in good faith), and repayment on said loan is $400/month, then this would be deducted from the current disposable income of $500/month. Debtor's payment to nonpriority creditors would presumably be $100/month or $3600-$6000. This is huge difference and can truly help a debtor in a Chapter 13 reduce what they pay to their creditors.
One important caveat to 401K loans: they must be taken out with a presumption of bad faith. This means that the 401K loan cannot be taken out primarily to lower disposable income and reduce creditor payments. Factors that are analyzed to determine bad faith include the timing of the loan. If a person takes a 401K loan on the eve of bankruptcy, the court can object on bad faith grounds and attempt to force the debtor to pay an amount commensurate with presumed disposable income prior to the incurrence of the 401K debt. In short, it is not advisable to take out 401K loans (especially in large amounts) just before filing a bankruptcy.
But if the 401K loan was taken out in good faith, then the added deduction from having to pay said loan back will certainly help a Chapter 13 debtor pay as little back as possible.