A federal judge ruled that President Donald Trump cannot bypass Congress to withhold $4 billion in foreign aid, saying appropriations must be honoured unless lawmakers decide otherwise.