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