<p>(using the IMAP commands, not with the assistance of any other mail package)</p>

I guess you COPY the message to the new folder and then delete (EXPUNGE) it in the old one.
RFC3501
HINT
There's no DELETE command that does what you mean, you have to flag the message as deleted and then EXPUNGE the mailbox. Have a look at the RFC. Be careful with DELETE, as it deletes whole mailboxes, not single mails.