Short and simple:
Normally it refers to a homeless person but in fact it is an common insult.
If your friend calls you "Penner", you should probably take this as insult.
If your teacher talks about "Penner", he probably means a homeless person. (Normally the teacher wouldn't say "Penner".)
In German most sentences depend on the person and situation.