My Summary:
In cases of evictions arising out of non-payment or no-fault MGL 239, 8A allows defenses and counterclaims while in cases of for-cause evictions MGL 239, 2A allows defenses and MGL 186, 18 allows counterclaims.
Here is the the new case 2025 Campbell v Abdulla.