Yes, if the state and loan documents allow for a deficiency
judgment, the bank can sue for one after the home has been sold at
the sheriff sale and there is a deficiency.
If the homeowners are sued after the public auction and the bank
gets a deficiency judgment, then bankruptcy can be used to
discharge the judgment.
However, bankruptcy can not be used in advance before a
deficiency judgment or other debt even exists to preclude its
possibility.