A loan against your 401k is a very bad idea indeed. You contributed pre-tax funds to your 401k plan. When you take out a loan using your 401k as collateral, you have to repay the loan with after tax money. In other words, you have to pay taxes on the money that you earn which you then use to repay the loan. Therefore, after you repay the loan, your 401 now has AFTER TAX MONEY, whereas before the loan it had pretax money. Then, when you eventually withdraw the money, you pay taxes on that money AGAIN. If you didn't take out the loan, you would have paid taxes on that money only once.
If you borrow $10,000 from your 401k plan, and assuming you are in the 25% tax bracket, you have to earn $13,333 to repay the $10,000. Then, when you later withdraw the funds from the 401 plan, (assuming you are in the same tax bracket) you have to pay $2,500 in taxes, which leaves you with $7,500. So, to summarize, you earned $13,333, and you get to keep $7,500. That's a tax rate of 43%.
If you do not borrow from your 401k plan, you have to earn $10,000 to contribute $10,000 (contributions are tax deferred). Then, when you later withdraw the funds, you pay $2,500 in taxes, which leaves you with $7,500. That's a tax rate of 25%.
That $10,000 loan costs you $3,333. A $50,000 loan would cost you $16,665 in taxes. (Not counting the interest charges)