Earlier quoted context omitted.
Its also not legal in Germany, in fact, its pretty impossible to legally give a bad reference. HR departments have a workaround though - instead of a bad reference, they will simply confirm that yes, you worked there. Nothing else.
Are reference letters no longer done in Germany? When I was there that was how this was done. Basically you would always get a reference letter when ending employment. The reference letter's language always sounds good, as in not giving a bad reference. However, a reference letter that states things like "employee X delivered his tasks on time and to the satisfaction of work standards" basically means that he's a sla…
https://www.arbeitszeugnis.de/presse/geheimcodeliste.pdf (German)
This shows that there's a conflict: law forbids to discriminate someone with a bad review of their capability, motivation or fitness. But people always seem to try to work around this prohibition. Like giving a friendly declaration that someone worked at a company if they weren't impressed and give an enthusiastic recommendation in the other case.