The license fee imposed by this part does not apply to any vehicle owned by the United States, by any foreign government, by a consul or other official representative of any foreign government, by the state, by any political subdivision of the state, or by any city, city and county, county, district, public corporation, or by a public fire department organized as a nonprofit corporation and used exclusively for firefighting purposes or exclusively as an ambulance.