...I had a local IMAP server failure a while back. Disk went, no hope of recovery.
What I did when I set the new box up was to create a couple of dummy accounts in Mail so that Mail had two accounts in its setup - the old'n'busted one, and the new hotness.
What this meant I could do was just drag'n'drop the folder heirarchy from o'n'b to nh.
I then fucked about with the accounts on the server to make them line up with the Mail setup. The dummy accounts were then nuked.
Nowadays, though, I'd just use Time Machine.