(a) If, upon indictment or information, the defendant is acquitted, the costs shall be paid by the county.
(b) In cases of surety of the peace (which are herein deemed to be cases of a criminal nature) the court may order that the costs shall be paid by the defendant or by the prosecutor or by the county, as it deems just.