It's called a viatical contract. Viaticals allow people who are terminally ill to sell their life insurance policies for a percentage of its face value.
Some viatical arrangements are private, perhaps among family members.
These days, viaticals have become big business, with viatical companies luring investors to buy policies in bulk. We have a lot of information on viaticals , including consumer tips, investor woes, and rogue viatical companies.