This saying surfaced in American English in the early twentieth century, usually applied to someone whose rural habits survived a move to the city. No single author gets credit. It drifted into the language the way proverbs do, through newspaper columns, vaudeville routines, and kitchen-table repetition.
What makes it stick is the structural joke. The first half concedes the move, the second half quietly denies that the move changed anything. The reversal does the argument's work without arguing.
Linguists who collect proverbial chiasmus examples often cite this one as the cleanest illustration of how reversal alone can carry a complete thought.
Source
en.wiktionary.org/wiki/you_can_take_the_boy_out_of_the_country