US President Donald Trump has threatened to penalise so called "sanctuary cities", which are designed to shield undocumented residents from federal immigration agents.