When any county, city, district, or other public agency or entity, or any officer thereof in his official capacity, is a party, costs shall be awarded against it on the same basis as against any other party and, when awarded, must be paid out of the treasury thereof.
Ca. Civ. Proc. Code § 1029