We bought my father in law's house from him so that he could pay for in-home care in his final years. He continued to live there until his death, rent free.

We bought my father in law's house in Puerto Rico from him in 2009 so that he would have the resources to pay for in-home care in his final years.  He continued to live there until his death, rent free. We sold the house in 2017 for a small net loss.  I understand that 2nd homes are not deductible, but in some sense this is not a 2nd home.  What is the deductibility?