Have you considered taking the 40,000 loan route, and either a) using the excess to make improvements and/or repairs, or b)repaying the bulk of the loan immediately, or c) some combination of a and b? You would get banged for higher costs on the transaction than on a $6k loan, but it may be worth it to you.
There’s no way any of the banks will ok a loan of $40,000 on a house that is for sale for only $10,000. I kind of wish they would, I really do.