Antimetabole
An antimetabole is the identical or near repetition of words in one phrase or clause, in reverse order in the next phrase or clause. For example, US President John F. Kennedy used an antimetabole in this famous statement: "Ask not what your country can do for you; ask what you can do for your country".