Your 401(k) isn't your personal piggy bank, but that doesn't mean you can't take a loan from it.

But as the capitalist bonanza that is Black Friday approaches and holiday shopping season marches on at a quickened clip, consumers strapped for cash may be tempted by that ever-growing pot of cash they have tucked away with Fidelity or Vanguard for their golden years. What's a $5,000 or $10,000 loan from your pension fund if you're going to be able to spread that Christmas cheer and equip your family with Apple (AAPL) iPhone Xs, Nintendo Switches and a getaway to Hawaii, right? Think again, wanna-be Kris Kringle.   

Financial advisors absolutely hate the fact that people borrow against their 401(k) or dip into it outright. If you want to make an advisor shudder, tell him this: financial firm UBS found that more than half of Millennials with retirement accounts have or would consider dipping into them to make a large purchase, with 25% having already withdrawn funds.

That drives advisors nuts, because you're losing not only that money but also the growth that goes along with it. That said, UBS also found that 73% of Millennials tend to focus on short-term needs and goals, such as homes, travel and gifts, believing retirement is too far away to worry about. Eric Meermann, certified financial planner and vice president of Palisades Hudson Financial Group in Stamford, Conn., says those short-term needs are sometimes unavoidable.

"Borrowing from your 401(k) plan can be a smart move if you need the money for a serious purpose, such as a home down payment or to pay down high-interest debt," he says. "But you must be sure you can pay off the loan."

Meermann points to flood damage from Hurricane Harvey and Hurricane Irma as examples of unavoidable immediate expenses that might benefit from a 401(k) loan. Rather than using a credit card with a high annual percentage rate to cover added costs, you can loan yourself money from your 401(k) without tax penalties. Since there isn't a lender involved, you also won't have to pay additional fees.

"Interest doesn't vanish into a lender's pocket: you pay yourself," he says. "It's more like buying a bond. You may even achieve a higher yield than you would by investing in bonds in your account."

Typically, you can borrow up to 50% of your account balance or $50,000, whichever is less. Regulations require five-year repayment schedule, but you can pay off the loan faster if you like. However, if you have to use the loan to buy a new home, you may have up to 15 years to pay it back. Payments usually come directly out of your paycheck after taxes, and your plan determines your interest rate. You just have to hope your employer plays along.

"Consider your job security before taking a loan," Meermann says. "If you still owe money when you leave your job, you will need to repay the balance in full within a short grace period, usually 60 to 90 days."

Robert Steen, a certified financial planner at USAA, notes that even employees who keep their job can get into trouble if they aren't able to repay the loan. When you default, the loan becomes taxable and is treated like a required minimum distribution. That means you owe not only yourself, but the Internal Revenue Service.

"Retirement savings accounts, such as 401(k)s or IRAs, often face a 10% tax penalty on funds withdrawn before age 59.5, or that are not rolled-over within 60 days," he says. "Avoid borrowing from your retirement unless necessary, and to discuss the penalties you might face with your financial provider before moving forward."

Catherine Golladay, a senior vice president at Charles Schwab, notes that the 10% penalty is the least of your worries if you've taken an early distribution. The government will also take 20T of your withdrawal as an advance on your tax bill. She also notes that some plans may bar employees who have taken a withdrawal from contributing for the next six months, which will only further derail your savings efforts. However, even a 401(k) loan should be seen as a last resort."

There are a number of negative consequences associated with taking 401(k) loans, especially where taxes are concerned," she says. "First of all, you must repay the loan with after-tax dollars, negating many of the great tax benefits of the plan."

But Meermann doesn't necessarily agree that a loan will knock out all of the 401(k)'s benefits. Yes, the average annual rate of return on a 401(k) is 10%, or well more than the average 3% interest on a 401(k) loan. But that 10% assumes a rising market, which makes a 401(k) loan somewhat ideal if a market goes into a slump.

"You can actually increase your wealth if the market happens to dip while your 401(k) loan is outstanding," Meermann says. "The objection to borrowing on the grounds of missing potential gains ignores the potential for losses over short periods."

While Meermann suggests considering other sources of funding first -- like loans from friends are a home equity line of credit -- there are scenarios in which a 401(k) loan makes sense, as long as it's not completely frivolous as with luxury gift items. Folks who are "retirement-fund rich" -- who have a good salary, little taxable money, significant retirement savings and big debt -- might want to consider a 401(k) loan in certain circumstances. Meerman notes that a loan from his profit-sharing retirement plan, which was structured the same way as a 401(k) loan, helped him pay down a significant portion of the principal on his six-figure student loan debt. That shortened the term of his loan as he continued to make the normal monthly payments. Instead of paying a high rate to the lenders, he paid himself at a lower rate.

"This strategy only works if you have the cash flow to support both loan payments," he says. "But if you can handle it, it can save you money because you'll pay off your debt faster."

It may also help finance the purchase of a first home, especially if a small apartment suddenly becomes untenable after children are born. Taking out a 401(k) loan can cut the time it takes to save up for a down payment and has a better interest rate than credit-card debt. Speaking of which, credit-card debt can also be paid down with a 401(k) loan but won't help if frivolous spending got you into debt in the first place.

"If you accumulated this debt due to an unusual event, such as a major medical expense, it can make sense to pay it off in one shot with a 401(k) loan," he says. "But if your credit card debt is the result of profligate spending, ask yourself if you've truly changed your ways before you even think about touching your retirement account."

Sure, use your 401(k) to help you out of a jam, but don't jeopardize your secure future just to have more presents wrapped under the tree.

TheStreet's "Black Friday and Holiday Shopping Survival Guide" series aims to help you, the consumer and the investor, navigate the holiday season, Black Friday, Cyber Monday and everything in between. Through a number stories, videos, graphics and other multimedia elements TheStreet takes a look at the biggest challenges of the season, the winners and losers from the shifting retail environment and much more. Read More about navigating the holiday season.

Holiday Survival Guide - TheStreet Special Report

Is Your Wallet Ready for Black Friday?

More from Retirement

Turn an Inherited IRA Into a Family Fortune

Turn an Inherited IRA Into a Family Fortune

Retirees Make One Big Investing Mistake - Not Planning!

Retirees Make One Big Investing Mistake - Not Planning!

Investing for Retirement? Consider Socially Responsible Investing

Investing for Retirement? Consider Socially Responsible Investing

The Best Places to Retire in the West, Southwest, and Southeast

The Best Places to Retire in the West, Southwest, and Southeast

How to Really Diversify Your Retirement Portfolio

How to Really Diversify Your Retirement Portfolio