When a defendant, whether a natural person or a corporation, against whom a civil action authorized by this chapter shall have been brought shall be adjudged guilty of usurping or intruding into, or unlawfully holding or exercising any office, franchise, or privilege, judgment shall be rendered that such defendant be excluded from such office, franchise, or privilege, and also that the plaintiff recover costs against such defendant. The court may also, in its discretion, assess a penalty not exceeding five hundred dollars against the defendant which penalty may be collected as a part of the judgment and the defendant shall be subject to body execution for collection of the same, and which when collected shall be paid into the treasury of the state.
SDCL 21-28-19