IANAL and am mostly familiar with this type of situation from rom-coms about down-on-their-luck dukes who live in crumbling, unsellable castles, so I'm not sure if that scenario truly exists in law or if it's just a handy conceit.
You hear about this a lot when people require certain kinds of care that Medicaid covers but Medicare does not. People will sign over all their assets (real estate, cars, financial instruments) to their spouse, then get divorced. All because the government doesn't consider you poor if you have wealth.