I finally traced the issue to a bad interaction between Mail, the IMAP server, and the iPhone. I'm not sure which of these is ultimately responsible, but somehow, one of the three would use a different location for one of the special mailboxes.
I was finally able to fix the problem, by following these steps:
- Identify the file name of the special mailboxes. To do so, I quit Mail and connected to the webmail server interface, where I created a draft message, an outgoing message, and a deleted message, each with known content. Then I disconnected from the webmail. In Mail, I searched for the content I had just created. This enabled me to identify the current name of the special mailboxes.
- In Mail, use the Mailbox » Use This Mailbox For menu to correctly identify each special mailbox.
- In iTunes (this is the crucial step), under iPhone » Info » Mail Accounts, select 'Sync selected Mail accounts.' Under iPhone » Info » Advanced, select 'Replace information on this iPhone: Mail Accounts,' then sync the iPhone.

