It's hard to judge, but intent means a lot to me. I grew up in a sarcastic home and we were throwing barbs at each other, trying to put the other down or elevate one's self enough to stay out of the muck (which, when you're youngest like I was is not "fair" since I could never get as much practice as my brother/stepmother who were masters).
My husband is clever and can be witty/humorous but his humor rarely tries to wound another (he does not feel threatened by others). If he does do something as a practical joke or to show the "stupidity" of another, it is clever and not hurtful in and of itself, and the other person, the "stupid" person does not get it.
I remember when we were a carload of people at a Christmas drive-through lighting festival that required a $7/per car entrance fee and our guest insisted on paying; he only had a $20 though and gave that to my husband who was driving and my husband gave him back his change, a $10, a $5, and 5 $1

The guy was barely a high school graduate so he sat with the "change" in his lap counting it over and over, muttering to himself. His girlfriend (my friend) only had to glance over to see what my husband had done and she told me and I laughed and told my husband he was "cruel" and he grinned, etc. and, even though she had told me what had happened and the three of us are laughing, the guy still didn't understand! We had to explain in slow detail before he got it and he laughed too (he was a practical joker himself so appreciated that sometimes he "deserved" it in return). I think he was more relieved to understand why the money didn't add up than that the joke had been played on him; just thinking it was about an argument between two guys about who would pay rather than that he didn't "get" it and it wouldn't have been funny with someone else who could do simple math.