Investment in education is always worth it.
Be it in Germany or anywhere in the world. If you are asking in terms of return, how much you can earn later on, then it depends on many factors. The social market economy of Germany will not make you rich in a short time, but it will also not make you wander for basic needs.
Now coming back to the investment part,
After considering both money and time, the only point left is the language. In Germany, in short term, it is fine, if you don’t know the language. For the long term, it is advisable to learn decent German, which will make your life in Germany a lot easier from daily life to German bureaucracy.
So, I can say it’s worth it if you are interested in learning and gaining knowledge in your field, later find a job with these skills you got, including the German language. I got employed after my MS within 2 months, making 50K+ per annum in a very affordable city named Magdeburg.
If making money is the only concern, Germany is not your cup of tea. Germany is the more or less complete secure package, where you have everything (Health, Education, Infrastructure, safety) you need, the same things would be available to your neighbor as well.