Deductions & credits

In the scenario you outlined, you have good reason not to be optimistic since your mother-in-law, apparently, does not qualify for the Section 121 (sale of principal residence) exclusion as a result of failing the ownership test.

 

See https://www.irs.gov/publications/p523#en_US_2020_publink10008939

 

Further, you will not be able to obtain any relief by reinvesting the profits; it makes no difference, in terms of capital gains tax, what you do with the proceeds.

 

Finally, a 1031 exchange would only be applicable to investment property which, of course, would not apply to a home owned by you but occupied (free of charge) as the principal residence of a family member.