Massachusetts Department of Revenue Directive 88-18 ("Computation of Excise; Lien or Encumbrance") explains the deeds excise tax consequences of a deed in lieu of foreclosure and of an assumed mortgage. It is sometimes difficult to keep the two straight, because they reach the opposite result.
On a deed in lieu of foreclosure (i.e., where the lender excepts a deed from the borrower instead of foreclosing on the property), there is a deeds excise tax due based on the amount of the debt being forgiven plus any other consideration paid to the borrower/transferor. As a practical matter, it would be rare for the borrower/transferor to get any money in a transaction such as this. However, the essence of a deed in lieu is forgiveness of a debt. Under federal income tax rules, forgiveness of a debt is income to the debtor. That analysis carries over to the deeds excise calculation. Let's say you owe the bank $100,000 on a mortgage which is in arrears, and you convince the bank to take a deed from you in lieu of foreclosing on the property. When that deed in lieu was recorded, the deeds excise tax would be assessed on the $100,000 forgiven debt.
An assumed mortgage carries a completely different calculation. If you purchase property "subject to a mortgage" or if you "assume and promise to pay an existing mortgage," the outstanding amount of that mortgage is deducted from any consideration paid when assessing the tax. So for example, if you agree to pay $100,000 for a house, but also agree to assume an existing $80,000 mortgage on it, your deeds excise tax liability would be calculated based on $20,000 (consideration less amount of mortgage assumed).