All fines and forfeitures imposed as a punishment for any offense or for the violation of any duty imposed by statute may be prosecuted for and recovered by indictment in the district court. In all cases of the imposition of a fine pursuant to statute, as punishment for any offense, the offender may be committed until it is paid or the offender is otherwise discharged according to law.