ยง 5523. Restitution. A court reversing or modifying a final judgment or order or affirming such a reversal or modification may order restitution of property or rights lost by the judgment or order, except that where the title of a purchaser in good faith and for value would be affected, the court may order the value or the purchase price restored or deposited in court.