It will be paid off by the endowment policy, or by the life insurance policy that went with the repayment mortgage.
Well that's the theory. At one time you could have been sure of it. No policy no mortgage.
If there isn't one, then yes it's a debt on the deceased's estate. More likely if it's a joint mortgage, half the outstanding mortgage will be a debt on the estate. If the estate can't pay it, then the surviving person will need to take it on or face the property being sold.