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, if it finds that the secretary acted arbitrarily or capriciously in restricting the activities or functions of the commission, may relieve the commission of the responsibility for payment of the secretary’s legal costs with regard to that action.