The question has a large number of angles to consider, which doesn't make it simple to find answers. Also, it has been a few years since I was an active part of the discussions about tuition fees, so some of my arguments might be a bit rusty.
National economy
First, the wider economical balance gets complicated if you look closer at the term "international student". There are exchange programs and guest schemes where a student will stay for only a short period (a year, maybe) and then goes back to a "home" university. Others come to Germany for the duration of their degree program. And after graduation, some go back, while others find employment here.
All these variants have to be considered for their costs and benefits. For example, to reach the entrance level for academic education, domestic students will have passed the German school system on tax payers money, while foreigners come already prepared. And only those that stay will pay taxes while working in presumably well-payed jobs.
Additionally, the European Union regulates equal access to all academic institutions within its borders. Insofar higher learning is seen as part of the unified European market, and economic costs and benefits must not be considered at a national level.
Students from countries outside the EU need a visum for studying in Germany. The relevant law, the Aufenhaltsgesetz of 2005 states a general purpose of issuing visas to students (§ 16):
Der Zugang von Ausländern zur Ausbildung dient der allgemeinen Bildung und der internationalen Verständigung ebenso wie der Sicherung des Bedarfs des deutschen Arbeitsmarktes an Fachkräften. Neben der Stärkung der wissenschaftlichen Beziehungen Deutschlands in der Welt trägt er auch zu internationaler Entwicklung bei...
Access to education for foreigners serves general education and international understanding as well as securing the German labour market's need for skilled workers. In addition to strengthening Germany's academic relations in the world, it also contributes to international development...
The benefit of securing talents for the German economy is one of several goals named. Accordingly, while the visum automatically ends with graduation, it will be prolongated for 18 months to give opportunity to search for employment. Politically, this was introduced as part of the ongoing discussion about skills shortages in the labour market.
This is far from a comprehensive discussion of the wider scope – I feel grossly unqualified to comment further. Instead, let's look at the immediate costs and benefits of international students during their stay.
Costs and benefits are distributed unequally for different parties.
Federal involvement
The federal state is obviously collecting indirect taxes like VAT from the students. but that is marginal beside the effects on the social security systems.
Students have to procure health insurance contracts. As young people, the costs they generate in the public health sector are much below the average. Domestic students below the age of 30 are mostly still covered by their family insurance. But for foreign students, there are special rates available that are around a third of what you would have to pay when working at minimum wage. (I hope the number still stands. At least during my time at university in the nineties, student insurance could be had at 40€ / month, compared to around 150€ at a low income fulltime job.)
Equally, if a student takes a job, they have to pay a percentage for the statutory pension insurance. Supposing they are leaving the country after graduation, this is a bit pointless, as they won't be able to actually claim their benefits after retirement. There is a mechanism by which they can recover the contributions payed after returning home for good, but it is a administrative nightmare to actually do so, and a lot of foreign students just consider it money lost – to the benefit of German pensioneers.
State involvement
States (Länder) pay for universities from their budgets. From a standpoint of public budgeting, they are pure costs. That is the reason why since the 1990ties during a period of two decades, public financing was almost halved.
Only now the states start to reconsider. Especially the training of teachers and other educators was scaled down so much that now schools are widely unable to hire needed staff. Unfortunately, that is the area with the lowest percentage of foreign students. The fact that most teachers will become Beamte, tenured servants of the state, poses serious hurdles for non-Germans, short of taking the German citicenship. On the other hand, this is an attractive prospect for refugees. They can secure their status, gain permanent residence, and the state gets much sought-after employees.
The area where states mostly hope to benefit from universities is regional development. A good current example is the Brandenburgische Technische Hochschule Cottbus southeast of Berlin. The Lausitz region is heavily dependent on its huge open lignite pits. But the end of the coal industry is nearing, within the next ten to fifteen years all coal extraction will end. The university has been slated to play a central role in transforming the regional economy towards renewable energy and other new technologies.
Foreign students play a dedicated role in that effort. For one, universities in general profit from having a international, cosmopolitan reputation. They stand for being part of an international academic community, and the more international scientists and students it can attract, the more advanced its research achievements are supposed to be. Beside that, in a region suffering of a loss of population, especially young people are sought after to settle down locally. If they are foreigners, even better: the city has to battle its reputation as a hotspot for right wing radicals and racists, something that is not very favorable to attract new businesses to the region.
And there is the final point: International students that stay after graduation and found a startup company are considered to be the strongest possible economical boost, especially because they come with the prospect of international contacts and export opportunities, something that the German economy traditionally depends on.
All that is a lot of wishfull thinking and planing for the future. International businesses founded by foreign students has so far been more a phenomenon of metropolitan regions like Berlin or Frankfurt (Main), where regional development and transformation do not play such a central role.
City involvement
Economical effects are very diverse in cities of different size and profile. The largest student population of Germany lives in Berlin, but 135,000 students among a general population of 3.7 million are almost invisible. In contrast the largest German university at Münster dominates the city with a total 65,000 students among 300,000 inhabitants.
Some cities in east Germany lost significant parts of their population since reunification. Universities there play a large stabilising role. Greifswald, Gera or Illmenau, to name just a few, all depended heavily on their academic institutions to stay afloat.
In that context, the role of foreign students is not that different from domestic ones. Every young person that lives there is a gain for the city and counters the ageing of the general population. Housing, public transport, culture, gastronomy are all branches of the economy that can thrive from students. Additionally, they may compensate workforce shortages in entry level, part time and minimally payed jobs by working during their studies to boost their finances.
In one respect, foreign students have an advantage over domestic ones. Communities get their share of the federal income taxes depending on the number of residents. Students that come from other regions of Germany tend to see their stay at university as a temporary move, and do not change their registered primary residence from their home town. That is the reason why a lot of university towns take strong measures to enforce a change of residence as required by law. Foreign students, on the other hand, have no opportunity to register anything but the location of the university. So on average, they have a stronger impact on the city revenues.
All these arguments topple on their head in large cities and metropolitan regions. There tend to be serious housing shortages in these sought after places, and students either won't have enough money to pay the rents asked for, or will be paying much less for a run-down inner city dwelling than what could be earned after upgrading it to a luxury appartment.
Dedicated student housing (I am reluctant to translate Studentenwohnheim as "dorm", it gives a wrong impression when compared to the American tradition) is a special case. The larger the city, the less domestic students depend on finding accomodations there. But for foreign students, they are essential, as private landlords will often not rent to them. As a result, student housing for the last twenty years has been almost exclusively used by foreign students. As far as I know, the Studentenwerke as operators are able to recover at least some of the costs involved from EU programs. (Remember, the largest part of the foreign student body are EU citizens.)
Larger than average unemployment rates and a significant proportion of the undereducated in the general population mean that students are not needed in the unskilled job market. (The one exception seems to be supermarket cashiers, where students are actively searched for.)
More opportunities for foreign students appear to be internships at companies looking to advance their international standing, or small niche markets like translators and tourist guides.
I am tempted to comment also on the area of public transport. Its economy is heavily changed by students in general. But as there is no aspect that would discern foreign from domestic students I have to pass it by.
University involvement
A university might mostly be interested in having a large number of international students for the reputation involved, but there might also be extra costs attached. While applicants are required to achieve an appropriate level of language skills before entering university, and at their own cost, this does not mean they will be able to navigate their programs smoothly. Most universities therefor provide specialized counselors and infrastructure for foreign students.
For German students, the right to enter a university and a study program of their own choice is considered to be guaranteed by the constitution and can only be denied if the university can prove it does not have the needed capacity for more students.. But this does not apply to foreign students. For them, the universities have a right to choose which applicants to accept. They are not free, state laws normally reserve a share of the places for foreigners, and the criteria for choosing are also regulated.
Nonetheless, in principle you might expect a tendency to steer international applicants towards programs which are not so much in demand among German students, or towards programs that have lower costs per student. Looking at the statistics, you will find not so much of that. The largest absolute numbers are in engineering (costly) including IT (moderately costly), medicine (even more costly, and much in demand), business (cheap) and law (moderately cheap). But that is not so different from the choices of domestic students. Looking at the percentage of foreign students by program, you can see that medicine, business and especially law are below the average of approx. 15 %. Especially in medicine that may be an effect of the heavy regulation of access due to demand. All the highest percentages are in engineering. Significantly above average is the interest in science programs, which are also costly, but tend to be lower in overall demand, and small in their absolute size.
To sum up, there isn't one dominant factor that decides the question. You could probably find studies for both sides, saying that foreign students are a boon or a bane for the economy. The above might be taken as a guide whether they cover the different relevant angles.