The modern meaning is mostly just “ironic”. Formerly there was more of an implication of insincere politeness. To thrust one’s tongue into one’s cheek was an insulting, but presumably easily concealed, gesture of contempt. To speak with one’s tongue in one’s cheek was to speak with false flattery or insincere courtesy.
I’ve also heard it used (especially in the form “tongue stuck in one’s cheek” to mean that one is could say much more (critical or derogatory) about someone or something, but is leaving it unspoken.