I'm the niece in this situation.
A family member offered to buy XH out of his share of the equity in our house so that DC and I wouldn't have to move home and schools. The plan was for us to get a joint mortgage because I couldn't get one on my own, but for family member to just retain their percentage in the equity while I paid off the mortgage, thereby increasing my stake in the equity.
For various reasons this didn't work out. In the end, family member paid XH and also paid off the mortgage that XH and I had. Family member paid solicitors to draw up paperwork so that now family member is effectively my bank. The house is in my name and I am paying off the mortgage by paying family member directly (mortgage is now enormous and wouldn't be feasible for me outside if this private arrangement).
At some point, I will have to sell in order for family member to get their money back (with interest). We have a basic agreement to review when my youngest turns 18 and leaves school. I'm now thinking of sounding out family member about waiting until youngest graduates, if they go to university. Because I'd like to have enough space for DC to yo-yo back here until they're established in work themselves. But I accept that that may not be possible and I know I will have to move somewhere much smaller sooner or later, and DC may have to move out at that point if I can't accommodate them.
Ultimately, family member is just absolutely amazing and has probably had the single biggest impact on my life and definitely in terms of getting me back on my feet after divorce. I can never thank them enough or truly repay them for their kindness - I don't think them getting their money back, even with interest, comes close to what they did by allowing DC and me to stay in our home and not further disrupt lives and education.
I don't know if an arrangement like this (either joint mortgage or with you as the mortgage lender) is an option for you, but it might be worth looking into. Although I think the legal fees were quite a lot to set it all up.