When traveling expenses are allowed by law to any state, county, judicial district, or city officer, he may contract with the appropriate authorities for an allowance or mileage rate for the use of vehicles owned or rented and used by him in the performance of duty, in lieu of the usual transportation charges.