To do otherwise creates a windfall to the occupiers of the house. But to throw the occupiers out prior to proving ownership is a presumption of legal fact.
The court has no authority to take anything or appoint anyone until a petitioner can prove legal standing (snicker)to have brought suit in the first place.
"It's ours because we say so" doesn't cut it in a true court of Law.
In most states it does not take going to court to foreclose. The trustee just runs the foreclosure in the paper and put a notice up at the court house. If you wish to contest it the first think the judge asks for is your proof of payment. End of game.