I write this answer from a US perspective in biomedical sciences and don't have any specific experience with academia in Germany besides friends who are there.
I would say this is not that unusual for a field with good funding resources and a position for which candidates are in high-demand (especially quantitative fields).
Even for prospective graduate students in the US in my field, it is typical for hosting programs to fly in prospective students and cover their costs during an interview.
What is a bit unusual is that (based on your comment) this is your first level of interview, as it would be more typical to start with a more informal interview over the phone, Skype, etc for a position like this. You would expect that these expenses would only be used for the top 1-2 candidates for a position. However, if the number of applicants is sufficiently low, they might feel like it is necessary to invite anyone that meets their other qualifications based on an application.
However, like hiring in industry, consider that the transportation costs involved are still only a fraction of what it costs to pay an individual to work for two years. Based on other Q&A here at Academia.SE, in-person interviews seem a lot less common in Asia, and maybe more generally in places where the ratio between salary and travel expenses is smaller.