I just moved from a FreeBSD/Intel mail server to an Xserve, after a few days of research and testing utilities that half worked or didn’t work at all, I found imapsync:
http://freshmeat.net/projects/imapsync/
I ran it from a linux box, but it’s perl based, so it should theoretically work on an OSX box as well.