SCHOOL ADMINISTRATORS AROUND the state, faced with rising costs and stagnant budgets, are turning outside their districts —even outside the country—to attract tuition money from foreign students and students from other communities inside Massachusetts.

The money falls into three pots. According to fiscal 2014 figures from the Department of Elementary and Secondary Education, 21 public school districts received a total of $2.8 million in tuition paid by individuals, including foreign students. Another 101 districts pocketed $32.4 million from other school districts for providing educational programming to their students, primarily special education services and pre-kindergarten. And 178 districts participated in the state’s school choice program and were paid $89 million for educating nearly 15,000 full and part-time students from other districts.

“If [schools] are being compensated for it, it’s a no-lose proposition,” says Christopher Bogden, CEO of the Cape Cod-based education company Inspiritas, which finds placements for American students abroad and is working to do the same with foreign students, especially Chinese and South Korean students, here. “If you add a student or two or three, the burden on the educational infrastructure can be minimal.”

The number of foreign students attending Massachusetts public high schools is still fairly small but rising quickly. According to the US Department of Homeland Security, which issues student visas, there were 422 foreign students —about 7.4 percent of the total nationwide—attending Massachusetts public high schools in November, up from 100 as recently as 2011.

The student visas allow foreign students to pay to attend one year at a public high school certified by US Customs Immigration and Enforcement. Some students come just for their senior year and hope to gain entrance to a US college after they graduate. Others spend a year at a public high school and then try to transfer to private schools, which are allowed to accept students for a longer period of time.

Brookline received $1.2 million last year in tuition from individual students, including some from outside the country. Brookline charges foreign students $16,500, the approximate per pupil cost for the town. Brookline did not respond to requests for a breakdown of how much of the $1.2 million came from students from foreign countries. Some of the money came from users of other school programs such as extended day services and early childhood education.

School choice is anotheCommonwealth-Winter-2016-Final-23r avenue for public schools to bring in added revenue. The program allows school districts to enroll students from other districts, which must reimburse the enrolling district for its costs. The tuition is capped at 75 percent of the per pupil cost up to a maximum of $5,000. Of the more than 500 public school districts in Massachusetts, 178 open up their classrooms to students from outside the district through the school choice program.

Northampton brings in the most revenue from school choice, receiving more than $1.8 million in fiscal year 2015. The net benefit to the district is lower than that amount, however, since nearly 70 Northampton students chose to go somewhere else, costing the district nearly $528,000.  Leominster lost close to $2 million when 334 students attended school elsewhere, but partially offset that loss by bringing  in 247 students from outside the district who brought with them tuition of $1.4 million.

Gateway Cities take the biggest hit in student and funding loss. Springfield shows the biggest loss, according to state data, with 746 students choosing to go elsewhere at a net loss of $4.4 million. In the 2014-15 school year, Pittsfield, Gardner, Holyoke, and Fitchburg each reported 333 to 450 students lost to neighboring districts.

School districts can also bring in additional revenue from other school districts which find it cheaper to pay for educational services rather than offering their own. The town of Harvard, for example, takes in 68 school choice students and also educates students from next-door Devens, which doesn’t have schools of its own. Devens is a former military base that is now run by MassDevelopment, the state’s economic development and finance authority.

Overall, Harvard receives nearly $1.3 million in tuition payments, the third-highest amount in the state. “Our budget relies on these revenues as an offset,” says Harvard superintendent Linda Dwight.

Like Harvard, some districts charge for pre-K and/or half-day kindergarten, as self-sustaining programs to expand their student base. In addition, some districts create programs within their own schools to meet the needs of their own special education students and then open up the programs to students from other districts. In 2014, Peabody collected $115,000 for educating special needs students from other districts.

Amber Bock, the superintendent of the Westborough schools, says it’s understandable why administrators try to bring in students from outside the district.

“Many districts are looking for things that diversify that tax base,” she says. “Our goal is to provide for our students and keep the cost as low as possible.” Westborough doesn’t accept tuition-paying students from outside the district, but Bock’s previous job was in Weston, which does accept foreign students.

Bogden, who has served as superintendent for public school districts in New York and has served as a consultant to public schools in Massachusetts as well as the administrator of a for-profit company running charter schools in Massachusetts, says accepting tuition-paying students from outside the district is a good way to maintain existing services.

“For districts with declining enrollments, where your facilities have a greater capacity than enrollment, it allows you to maintain programs,” he says. But, he adds, the extra money should be viewed with caution. “It’s considered discretionary until you have to rely on it,” he says.

Bristol County Agricultural High School in Dighton collected $664,479 in 2014 for educating students from outside the district. Superintendent Stephen Dempsey says he isn’t certified by Homeland Security to accept foreign students but is intrigued by the idea. “Maybe I should look into it,” he says. “It sounds like a revenue generator.”

(Correction: A chart that originally ran with this story misidentified the source of tuition for some schools. The chart has been removed.)