These jokes highlight the arbitrary, conventional, and context-dependent nature of language usage, including pronunciation, spelling, and meaning.
Also, check out Merriam-Webster's section on wordplay: https://www.merriam-webster.com/wordplay