Canadian here. Been in the US for two years doing grad school. When I went back to Canada once the Canadian customs told me I should declare myself as a "US resident visiting Canada". I am a resident of US for tax purposes obviously. I think the IRS and the CBP have different standards for residency, the one that benefits them more.