It is for the purpose of encouraging those low-achieving schools to achieve more. Primarily, it would serve as an incentive to them. If, for example, a particular school needs more funds, then they should try to engage themselves more to endeavor that awaits them and bring honor to the said institution by achieving more. Also, if that's the case, providing more funds to the school with quite a lot of achievements will certainly tolerate competitions, giving way to a better education.
My thinking on this is that a school with fewer kids would also be physically smaller and have less staff. They would need less money for updated textbooks, technology, and other things. A school with more students would be physically larger and need more money for textbooks, technology, and other things. Example: An eighth grade class of 50 with basic algebra as a required course would need 50 basic algebra textbooks. An eighth grade class of 100 would need 100 copies of the same book. A larger number of students = more money need for supplies and updated equipment. Throw in some government assistance for unexpected expenses like needing the heating/cooling system replaced and I think you would have a good funding system for schools.
Basing school funding on academic achievement is just a way to favor rich neighborhoods over poor ones, which current school funding mechanisms already do. The reality is most of the issues in schools, if not all the major ones, are due to poverty and inequality within our society, which has been proven over and over again. So thus poor schools do worse academically than wealthy ones.
Just because the schools are performing poorly doesn't mean that students aren't trying. If anything, it's the schools that score poorly that need the most help. Many schools lack the funds to keep textbooks modern, much less have access to computers. A good education needs money drilled into it, and not funding poorly achieving schools - generally in lower class areas - simply keeps the students down.