After Superintendent Lewis Ferebee joined Indianapolis Public Schools in 2013, one of his first accomplishments was determining that the district had a $8.4 million surplus rather than the ballooning deficit the prior administration reported.

But fast forward less than five years, and the district budget has gotten much tighter. Officials expect to spend about $21 million more than the district takes in this year. The deficit is so severe that district leaders are making the case to the voters on the November ballot that it needs $220 million more for operating expenses over eight years to continue meeting the needs of students.

So how did the state’s largest district go from having extra cash to an intractable deficit? In part, it’s because Ferebee’s administration made big investments in his early years — for example, spending on teacher pay increases and more autonomy for schools. But the district, which educates many of the poorest students in the state, also saw its state funding drop. We’ll spell out how and why here.

Here’s a look at how funding for district schools has changed in recent years:

The largest chunk of school revenue in Indiana comes from the state, and every two years, the legislature crafts a formula for determining how much money each district will get per student. That pays for the bulk of the operating costs, such as teacher salaries. But in recent years, lawmakers have cut funding for Indianapolis Public Schools.

Over the last five years, the amount of money both per pupil and in total the district gets from the state has steadily declined. In 2013-14, the district received more than $254 million from the state. That included a base per-pupil tuition, plus money for students from low-income families and special programs such as career and technical education. Four years later, that amount had dropped by close to $24 million to about $230 million, according to state data.

Some of that decline was likely because district enrollment fell by about 620 students over that period. But that drop is not nearly enough to account for losing $24 million in funding.

Indianapolis Public Schools has historically gotten more money from the state because it educates many students in poverty. But there is always a tension over how to make funding fair between urban districts with large numbers of low-income families and middle-class districts that receive substantially less funding per pupil from the state.

In recent years, state lawmakers have eliminated several programs that tended to provide high-poverty districts with extra money, such as aid districts once received to soften the financial blow when enrollment dropped. Between 2013-14 and 2016-17, the district lost about $7.4 million in basic funding and money for full-day kindergarten.

The state has also cut millions of dollars from the amount of money, known as complexity, that Indianapolis Public Schools receives for high-needs students, such as those from low-income families. Between 2013-14 and 2016-17, the district’s complexity funding fell by about $14 million to about $57 million.

There are a few reasons Indianapolis Public Schools is getting less funding for poor students from the state. Over the last several years, Indiana has dramatically cut complexity funding across the state, and it has changed the way it counts students in poverty.

Three years ago, Indiana changed the way it calculates poverty in schools. It now uses participation in programs such as welfare and food stamps to determine how much aid district’s receive for educating poor students instead of the number of students eligible for subsidized meals or textbooks, a move that some argued would reduce poverty funding for districts.

The Indianapolis Public Schools poverty rate could also be changing. The number of students who are poor enough to qualify for subsidized meals has declined in recent years to about 73.2 percent. But that number is almost certainly undercounting poverty, since the district began giving free meals to all students in 2014-15. Because of that, families no longer need to file qualifying paperwork to get the benefits of the program.

Indianapolis Public Schools serves a community that includes many poor families, and the median income of about $32,000 per year is $18,500 less than the state as a whole, according to 2016 data from the American Community Survey.

Federal funding makes up a smaller portion of the district’s budget, but over the long term, it also fell as part of a national trend. The district received about $55 million in federal funding in 2016-17, according to a district report. That funding has held relatively steady over the last three years, but it is down about $18 million from the most recent peak in 2012-13.

That cliff came when recession-era stimulus funding ended, and the federal government made other cuts to education, according to Indianapolis Public Schools chief financial manager Weston Young.

One bright spot for the district is growing local funding, which pays for expenses like busing and building maintenance. The district received about $136 million in local funding in 2016-17, up about $5 million from 2013-14. That includes money that the district makes from leasing or selling property. Indianapolis Public Schools officials say local revenue is growing because property values in the district boundaries are rising and driving up property tax revenue.