The 32-year-old man was not due to be released from Dresden prison, but he looked similar to his cell-mate and got himself the same kind of haircut, the Süddeutsche Zeitung reported on Friday.
"This has not happened to me in 30 years," said prison director Ulrich Schwarzer.
He said the man, reportedly from Hungary, had been serving time for theft, but that he was about to be charged with a more serious crime of human trafficking. It is alleged he brought a 15-year-old girl with him to Germany and forced her to work as a prostitute.
It seems he talked his cell-mate into letting him take his place on release-day.
Schwarzer said the man and his cell-mate did look alike. "They do look very similar in photos," he said.
Once he had done his hair to match his friend's, the cunning plan was complete.
No-one noticed the deception on the day of his release, said Schwarzer. "Several prisoners were released on the same day," he said, admitting that his officers had only a print-out of a photo to use to check his identity.
Officers collected the wrong man from his cell, handed him his cell-mates belongings, filled out the release forms and waved him off into freedom.