This is not a mortgage question. It's an inheritance law question.
When a person dies, all their assets go into their estate. Let's say it's Mr Brown. The Estate of Mr Brown now owns the house. The Estate of Mr Brown has to pay off the mortgage before Mr Brown's heirs can get anything from it. If the Estate of Mr Brown does not have other assets with which to pay the mortgage off, then the the house would have to be sold to pay off that mortgage, and if a sole heir wishes to buy the house then the heir has to come up with the money to pay off the mortgage. An heir's chances of being able to continue with Mr Brown's mortgage, if the heir doesn't qualify for a mortgage in his own name of that size, are very poor in Canada. If there is more than one heir, they have to be paid for their share of the house by the one who buys it.
Am I simplifying? You bet. I'm not an estate lawyer. And there are details that could matter quite a bit and I don't know them. I'd consult a lawyer if I were you and really wanted to know how things play out when someone dies, with all the facts of the mortgage, assets other than the house, the debts, the insurance, and the will, though it's up to your in-laws if they want to give you all that. They don't have to tell you any of it. If I wanted to make sure someone got my house in the most painless way possible for them, I'd also consult a lawyer to make sure the will was written correctly.
We don't have inheritance tax in Canada, at least not by that name, but there are probate fees. Most wills must be probated. in Ontario, it's roughly 1.5% of the total value of the estate. If your in-laws were able to borrow $400,000 on that house then my guess is that it's worth at least a million. The estate or the heir(s) must pay 1.5% of that amount before anything can change hands. There will also be other expenses, probably including a lawyer's bill of at least $5,000, probably more. Many lawyers charge a percentage of the value of the estate.