A troubled New York nursing home has won an agreement to sell, now turning operations over to the receiver it once battled with.