Can a Canadian citizen marry an American citizen in the US?

anyone can marry anyone from anywhere, however it does not make the immigrant legal, and alot of the time, has no effect on the courts decision if the immigrant can stay