In Season 2 Episode 1, after Mycroft explodes Sherlock's belongings, he says something to Sherlock: "Have a safe trip back to the colonies". Sherlock was to return to New York. But the tv series is set in the 21st century, where the US has already achieved independence. Was this a movie mistake?
No this is not a mistake.
It's just a British form of derogatory humour to continue to refer to the US as "the Colonies".
It's not something that would be used in everyday speech to refer to America but if the speaker wanted to imply that the US was in some way "lesser" they would put it down by using the term...as in former colonies, as though the War of Independence had never happened.
For the same reason, Americans are sometimes referred to by the British as "colonial cousins" and Australians as "convicts".
It's not intended to be offensive, just mildly (and perhaps humourously) insulting.