That's Stack Exchange's prime directive. Trolling someone, for whatever reasons you may think you have, is not OK. My favorite part of the Be Nice page says the following.
Your tone should match the way you'd talk in person with someone you respect and whom you want to respect you. If you don't have time to say something politely, just leave it for someone who does.
So, if someone comes here with their homework, it is of course acceptable to notify them that we won't do their homework for them, but that's also where the interaction should stop. Trolling, belittling, name calling, bullying, and any other kind of confrontation that is intended for your amusement is not only completely disrespectful and unnecessary, it is so far over the line that it doesn't even make sense to have a meta discussion about it.
TL;DR Trolling other users, even if they're here for the wrong reasons and especially if they're new, is not only not allowed, it will get you suspended.