In the German state North-Rhine-Westphalia cheating in university exams is a contravention (Ordnungswidrigkeit) and can be a crime if the university demanded a declaration in lieu of oath.
In the North-Rine-Westphalian law on universities (Hochschulgesetz) § 63 V says:
(5) Die Hochschulen und die staatlichen Prüfungsämter können von den Prüfungskandidatinnen und Prüfungskandidaten eine Versicherung an Eides Statt verlangen und abnehmen, dass die Prüfungsleistung von ihnen selbständig und ohne unzulässige fremde Hilfe erbracht worden ist. Wer vorsätzlich
gegen eine die Täuschung über Prüfungsleistungen betreffende Regelung einer Hochschulprüfungsordnung oder
gegen eine entsprechende Regelung einer staatlichen oder kirchlichen Prüfungsordnung
verstößt, handelt ordnungswidrig. Die Ordnungswidrigkeit kann mit einer Geldbuße bis zu 50 000 Euro geahndet werden. Die Hochschulen können das Nähere in einer Ordnung regeln. Zuständige Verwaltungsbehörde für die Verfolgung und Ahndung von Ordnungswidrigkeiten nach Satz 2 Nummer 1 ist die Kanzlerin oder der Kanzler sowie nach Satz 2 Nummer 2 das staatliche Prüfungsamt. Im Falle eines mehrfachen oder sonstigen schwerwiegenden Täuschungsversuches kann der Prüfling zudem exmatrikuliert werden.
So it is a contravention finable with up to 50 000 € to intentionally violate the examination regulations on cheating (sentence 2 f.). The details can be ruled by regulations of the universities. I have never heard of someone fined under this rule, but this does not mean it never takes place.
Additionally the univiersities can demand a declaration in lieu of oath that the examined took the exam without forbidden foreign help (sentence 1). This only applies to foreign help, not to "cheat sheets" and similar. Giving a false declaration in lieu of oath is a crime under §§ 156, 161 StGB both done intentionally and negligently. Such declarations are requested regularly for Hausarbeiten (papers written by students at home) but not for exams done in university.
Section 156
False declaration in lieu of oath
Whoever falsely makes a declaration in lieu of an oath before an authority which is competent to administer such declarations or falsely testifies whilst referring to such a declaration incurs a penalty of imprisonment for a term not exceeding three years or a fine.
Section 161
Negligent false oath; negligent false declaration in lieu of oath
(1) Whoever commits one of the offences referred to in sections 154 to 156 by negligence incurs a penalty of imprisonment for a term not exceeding one year or a fine.
(2) No penalty is incurred if the offender corrects the false statement in time. The provisions of section 158 (2) and (3) apply accordingly.
By § 159 (in combination with § 30) StGB it is even a crime to try to abet to a false declaration in lieu of an oath punishable with up to 2 years and 3 months at prison or a fine (§§ 30 I s. 2, 49 I n. 2 StGB).
Section 159
Attempt to abet false testimony
Section 30 (1) and section 31 (1) no. 1 and (2) apply accordingly to an attempt to abet false unsworn testimony (section 153) and a false declaration in lieu of an oath (section 156).
There may be similar rules in other federal states of Germany (the rules on universities are made by the states). I looked only for Bavaria and Baden-Württemberg where a declaration in lieu of an oath can only be demanded for PhD thesis and there is no contravention-rule.