In any case of prosecution under the provisions of this title in which the defendant is found not guilty or for any other reason costs are not recovered from the defendant, all costs of prosecution shall be paid as provided by Part IV of Title 42 (relating to financial matters).
75 Pa.C.S. § 6307