One of the ways is you can borrow against the 401 at a very low interest rate and pay the money back when you sell the property.
The other is to utilize the 401 into another IRA account and use the funds to purchase Real Estate. There is a book on it, but I don't recall the name.
If you are self-employed (i.e. active self-employment earned income separate from your w-2 income) with no full-time w-2 employees, you can set up a Solo 401k and then rollover your 401k funds from your former employer 401k.
You could then take a loan of up to 50% of the balance not to exceed $50,000. Please be sure to select a Solo 401k plan provider which allows you to take a loan and will prepare the required 401k loan documents.
The repayment terms are equal monthly/quarterly payments (as you prefer) of principal and interest (e.g. prime + 1%) spread over a 5 year term (or longer if you will use the loan to purchase your primary residence).
There are no prepayment penalties and no restrictions on what you can do with the proceeds of the 401k loan.
Please note that you are obligated to pay back their 401k (regardless of the performance of your real estate investment).
As an alternative to taking the loan, you could even purchase the investment property directly using funds in your Solo 401k (assuming you select a Solo 401k plan provider which allows you to invest in real estate). If you don't have enough Solo 401k funds to purchase the property as an all-cash deal, you can combine your Solo 401k funds with non-recourse debt to purchase the investment property. Learn more about non-recourse lenders here: https://www.biggerpockets.com/member-blogs/9552/70408-ira-and-solo-401k-non-recourse-lenders