That can be very, very risky. Why?
Because in 2005, the Bankruptcy Code was amended by the Bankruptcy Abuse Prevention and Consumer Protection Act (BAPCPA) to provide in Section 522(o) that if in the 10 years before you file bankruptcy, you put money that would not have been exempt, towards your homestead, and you do it with the intent to "hinder, delay or defraud" your creditors, the value of that property is not exempt. This could result in you losing your property.
What could happen? If you paid the money towards your mortgage to avoid paying your creditors, for example, and the bankruptcy trustee or a creditor objected and the court agreed with them, then the trustee would sell your homestead, pay off any mortgages, take the money that you had paid down in anticipation of filing bankruptcy and use it to pay off creditors, and give you the rest. Not so good for you!
In a recent case from the U.S. Bankruptcy Court for the Southern District of Texas, Houston Division, a widow used some of her deceased husband's life insurance money to invest in a pizza business, which then failed.
She was also on the hook for the remaining debts of the business, which were a large amount. In 2012 she paid $240,000 towards her home mortgage on her home in Magnolia, Texas, and then filed chapter 7 bankruptcy in Houston in 2013. In re Love-Baker, Bankr. SD Texas 2013.
The trustee and a bank objected to her exemption of her home using 11 USC Sec. 522(o), saying that she paid the $240,000 towards her home to avoid creditors, and that amount or value ($240,000) should not be exempt. But the Bankruptcy Court agreed with the widow, after she testified that the only reason that she paid the money, was because she had received investment information from 3 investment firms that the stock market was going to go down.
It was a happy result for the debtor in this case, but I don't recommend that you count on this happening in every case. Before you pay money down on your homestead mortgage before filing a bankruptcy, or certainly before you pay it off, consult with an experienced bankruptcy lawyer for advice.