However, 401(k) accounts frequently have a LOAN mechanism ~ the federal government's equivalent called a Thrift Savings Account does.
You have to pay the money back ~ but during a time of low dividends, stagnant market, and low interest, it might be worthwhile to borrow from your own account ~ because your payback is going to be made at a higher rate of interest than the marketplace can command.
The consequence will be to have short term use of a larger sum of money than you thought you might get (since you are setting the terms of the loan payback period), and you will be forced over the long haul to put in more money to pay off the loan than you could have earned if you'd left it there!
Worked correctly, if you usually save at the maximum rate, borrowing from your account is a neat way to stick more money into your account than the rules otherwise allow!
If you lose your job, you may be required to pay back the entire 401(k) loan at the time of termination, or pay taxes and penalties on the money. It seems a little risky if being done for other than critical needs.