It seems likely to me a house would become available for purchase shortly following the owners death. The house could be available for just a few days. If you haven't bought the house yourself within that time, an NPC could buy it.
hey guys you are forgettiing that this is like medieval times kinda.. what if the person doesnt have relatives or anyone to check on them?? the house would be yours right?? or if they do have relatives maybe one day while you are squating the family member shows up and is like wtf are you??? then attacks you and maybe one encounter you have like this the family member is a super crazy powerful wizrd!1
Aww I wanted yo vote for both "house goes up for sale" and "new npc moves in" but I voted other. I think it would be more realistic when the original npc of the house dies it goes up for sale for so many days and if you the main character decides not to buy it or if you can't afford it then a new npc moves in.