The commission shall reimburse the director for all expenditures incurred by the director in carrying out his or her duties and responsibilities pursuant to this chapter. However, the court may, if it finds that the director acted arbitrarily or capriciously in restricting the activities or functions of the commission, relieve the commission of the responsibility for payment of the director’s legal costs with regard to that action.