Section 11. Money recovered by an officer in an action of replevin for goods attached or taken on execution by him or recovered by him in an action upon the replevin bond shall be applied as follows:
First, To pay the lawful fees and charges of the officer and the reasonable expenses of the action of replevin and of the action on the bond, so far as such expenses are not reimbursed by the costs recovered.
Second, To pay to the creditor at whose suit the goods were attached or taken on execution the amount recovered by him in that action, or so much thereof as remains unpaid, with interest thereon at the rate of twelve per cent a year for the time during which the money has been withheld from him, or the service of his execution has been delayed by reason of the replevin.
If the attaching creditor in such case does not recover judgment in the action in which the attachment was made, or if a balance remains of the money so recovered by the officer after paying what is due to the creditor, such money shall be applied in the same manner as the surplus, if any, of the proceeds of sale would and ought to have been applied had the goods been sold on execution.