How can Apple Mail be configured to mimic Gmail's "Archiving" behaviour for a generic IMAP account?
Mail does have an action called "Archive" in the Message menu that moves the current message in to  a directory called "Archive."  I use it all day every day on my work IMAP account just like in Gmail.  I stash everything in there and just rely on search to find what I need.  It works great.

I don't think there's a way to remap the Delete key to perform an Archive action instead, but Archive does have a keyboard shortcut: control-command-A.  If you find that as clunky as I do, you can remap it in System Preferences' Keyboard pane.



You can also add Archive to your toolbar if that's more your thing.