By the law and I don't have an English article ready for that. Basically it's not clear and someone (probably a publisher) would have to go to court and would also probably win.By whom? Is that why games are treated differently? I'd love to read an article on this.
Here's an excerpt from a 2016 Spiegel article:
(AI translation by https://www.deepl.com/translator)"Wolfenstein 3D" was confiscated in Germany in 1994. Not for reasons of youth protection, but because of the use of symbols of anti-constitutional organisations. Of course, swastika flags and Hitler portraits were hung in the digital Nazi headquarters. Their use is a criminal offence according to section 86a of the Penal Code. There are exceptions to this rule for artworks, but the status of computer games as art is legally controversial. If a publisher wanted to use swastikas, he would have to go to court.
From an economic point of view, this is not to be recommended, says Stephan Mathé, lawyer for media law. The applicant would have to prepare for a process that could take several years. If he were right in the end, the game would be obsolete. In addition, the title "the company that legalized the use of the swastika in games" would be of rather dubious value. That's probably why no one has ever planned to do so, says Mathé