What you are describing is effectively a "life estate
," assuming that the son records the contract with the court/county clerk as if it were a deed. It's legal, but it won't avoid Medicaid penalties, any better than any other legal artifice.
Mother and son would be better to something called an Enhanced Life Estate Deed instead of a simple contract. The common name for this is a "lady-bird deed." The deed permits a property owner to gift property to someone else while retaining the right to remain in the property for the remainder of the owner's lifetime.
There are a number of websites that will offer you a lady-bird deed form at low cost. In my opinion, however, this particular issue should be handled by a local estate planning
attorney, because unique facts can create conditions which would make the use of a lady bird deed, or for that matter, any type of transfer, usless to avoid Medicaid penalties.
For a competent estate planning attorney referral, see this link
Please let me know if I can be of further assistance.