The cost of buildings, the maintenance, insurance, water, electricity all add up very quickly. Associated staff costs aren't cheap either - many schools have a nurse on staff to deal with injuries and illness, for example. Counselors/psychologists help troubled students. Learning specialists help deal with certain problems - as an example, when I was in kindergarten I was sent to a speech therapist a couple of times a week. Teaching assistants help care for the more severely disabled - some of them basically have a dedicated assistant based on their disability.
Buses aren't cheap either, and in rural areas, you might need several smaller buses to get everyone to school in a reasonable amount of time.
Schools in more urban areas often have security guards, and most schools have put more money into physical security as well with the perceived rise in school shootings (not trying to start a debate as to whether or not this is happening).
Administrators and secretaries plan and organize everything that isn't directly related to teaching, handle some disciplinary issues, and interface with other government agencies, the school board, and the board of education at the state and sometimes even federal level.
Education is expensive, and you can't start cutting out pieces of this without very quickly impacting the students.