(a) When any judgment is recovered in a court of record by or in favor of any party, all officers who in pursuance of law and attorneys who upon contract expressed or implied have rendered service for or in behalf of the party in the action or proceedings in or upon which the judgment was rendered, shall severally have liens upon and an interest in the judgment, as follows:
(1) Each officer to the amount to which he or she is entitled by law as costs, fees, allowances, or otherwise for services rendered to or on behalf of the party; and
(2) Each attorney to the amount to which he or she is entitled by contract or, if no amount is fixed, a reasonable compensation for his or her services rendered as set forth above for or on behalf of the party.
(b)
(1) Any property sold upon, in pursuance of, or to satisfy the judgment and purchased, directly or indirectly, by or on behalf of the party in whose favor the judgment was rendered, his or her heir, personal representative, or assignee, shall be deemed to be held in trust for any person holding a lien to the amount of his or her lien until the lien is discharged.
(2) When the judgment is for the recovery of real or personal property, the lien shall amount to an interest in the property to the extent of the lien.