A sheriff's contingent fund is created in each county to be kept by the county treasurer as all other county funds. One-fourth of all money paid into the county treasury on account of fines imposed for violation of the provisions of chapter 152 or 340A shall be credited to this contingent fund. The sheriff may expend money from this fund for the purpose of investigating and securing evidence of violations of chapters 152, 340A, and the DWI-related provisions of chapter 169A. Money may be withdrawn from the fund by the sheriff upon the order of the district court after application. At the close of the fiscal year any money in the fund in excess of $5,000 shall be transferred into the general fund.