A joke that is a play on words is a: Pun
A "Pun" is a joke exploiting the different possible meanings of a word or the fact that there are words which sound alike but have different meanings. In other words is a play of words that have the same sound (also called homonyms), but they have different meanings. They are usually humorous.