This article is part of our Subprime Survival Guide.

Tax laws are never simple.

Most of the tax-favored methods the government gives savers are associated with particular goals. For instance, IRAs and 401(k) plans are meant to give people a way to save toward their retirement, while 529 plans and Coverdell ESAs allow parents to set aside funds for their children to go to college. In many ways, it would be much easier to plan if the tax laws didn't allow you to do anything else with those funds; you'd know your retirement accounts would go toward retirement, and your education accounts would go toward education. You'd have to come up with your own way of saving for other goals, such as buying a house.

However, it isn't that simple. As it turns out, there are a number of ways you can take money that's supposedly earmarked for retirement and use it for other purposes. Specifically, people looking to buy a home have several options to take advantage of their retirement savings. Especially for those who are just starting out, being able to tap your retirement funds for more immediate needs is often very tempting. If you have bad credit, the problems faced by lenders like NovaStar Financial (NYSE:NFI) and Accredited Home Lenders (NASDAQ:LEND) may make it difficult or impossible for you to obtain traditional mortgage financing. Yet while each of these options can be useful, they also come with drawbacks that should make you think twice before you move forward.

Borrowing against your 401(k)
If you have an employer-sponsored 401(k) plan at work, you probably have the option to take a loan against the balance in your retirement account. Most plans limit the amount you can borrow to half of your vested account balance up to $50,000. But many give you a great deal of flexibility in how quickly you have to repay your loan, with some terms giving you as long as 15 years.

At first, this seems appealing because in essence, you're borrowing money from yourself -- the interest you pay goes back into your 401(k) plan, where you'll be able to withdraw it when you retire. However, there are some drawbacks. First, the tax impact is much different from a typical mortgage loan. If you borrow from a lender, you'll generally get to deduct the mortgage interest on your tax return. However, interest you pay on a 401(k) loan isn't tax-deductible, even though the reason you're borrowing the money is to buy a house. Even worse, you'll end up getting taxed again on the repaid interest when you start taking distributions from the retirement plan.

Perhaps the worst risk with 401(k) loans is that if you change jobs or get laid off, then you'll have to find a way to repay your loan immediately. If you don't, the loan will be treated as a taxable distribution from your retirement plan, and you'll pay tax on the full amount of the loan along with possible penalties. With many people switching jobs many times over the course of a career, using a 401(k) loan for long-term borrowing is pretty risky.

Withdrawing from IRAs
Another tax law provision allows you to take money out of your IRAs toward a down payment. The maximum you can withdraw is $10,000. The good thing about this is that you don't have to pay the usual penalties for pre-retirement withdrawals.

However, you'll still have to include the withdrawal as income on your taxes in the year you take it. That means that you'll have to come up with enough money to cover an unusually high tax bill. In addition, you're giving up the opportunity for tax-deferred growth on that money; you're not allowed to repay your IRA in the future.

The bottom line
Even though you should be cautious about using your retirement money to fund a down payment on a home, there are still some situations in which it makes sense to use retirement funds as a source of liquidity. As long as you're comfortable with any sacrifices you're making by diverting retirement funds toward your home, it may be the best source of financing available to you.     

For more on how to find the best financing for your home, take a look at our Home Center. You'll find a lot of information about every stage of the buying process that will ensure that you end up in the home of your dreams.

Fool contributor Dan Caplinger didn't touch his retirement funds when he bought his house. He doesn't own shares of the companies mentioned in this article. The Fool's disclosure policy is like a roof over your head.