Section 8. Except as required by General Law, each school district may determine how to allocate any funds appropriated for the support of public schools without regard to the categories employed in calculating the foundation budget; provided, however, that effective July 1, 1997, school or school districts which are determined to be under-performing or chronically under-performing within the meaning of sections 1J and 1K of chapter 69 may not allocate any such funds to cover legal expenses incurred in challenging such determination or in challenging actions taken by the board, the department or the commissioner in connection with such determination.