If the court finds that the beasts were lawfully taken or distrained, the defendant shall have judgment for the amount found to be due from the plaintiff for the penalty or forfeiture or for the damages for which the beasts were impounded, with the legal fees, costs, charges and expenses incurred by reason of the distress, and with the costs of the action of replevin; or, instead thereof, the court may render a judgment for a return of the beasts, to be held by the defendant irrepleviable by the plaintiff, and for the damages for the taking of the beasts by the replevin and for the defendant's costs. If so returned, the beasts shall be held and disposed of as if they had not been replevied.
Mass. Gen. Laws ch. 247, § 5