In Germany, is it possible to get a professorship in the same university where you earned a PhD? I did my PhD in a German university. I heard that it is not legally allowed to be professor in the same university. However, I see also some counterexamples in our field. Is this true? If so, why some people could still stay in the same university?
In Germany you cannot get your tenure in the same university where you already working. So to speak, you cannot promote to tenure in a university while working on this university. I explain myself, if you are a post-doc in Uni A you cannot get the professorship in this uni, no matter if you did or didn't your PhD there. You'll have to apply for better positions in other universities and, eventually, get hired in uni B. 
What I've seen is someone working in a post-doc position in Uni A, accepting a professorship in uni B, working there for a semester and coming back to Uni A as a professor. He was not promoted to professor in uni A, so it is not illegal.