A nice feature add by Apple in iOS 4 (the latest software rev for iPhones and iPod touches) is enhanced Gmail support. Beyond the threaded conversation feature, which supports all types of mail accounts, the Gmail account type (found when you go to set up a new account in Settings) now supports archiving under Gmail, such that “deleting” a message (air quotes because the icon in Mail has not changed) now removes the Inbox label from the message and leaves it in the All Mail folder. In addition, a horizontal swipe of a message or bulk editing of messages has a revised “Archive” text label, rather than saying “Delete.” Note that this archiving feature can be turned off.
You also get a nifty Gmail icon for your inbox now. Macworld has a nice article up on these revisions.
I previously set up this behavior myself using an “Other”-type mail account (as the prior Gmail preset available when you created a new account did not support IMAP), combined with a few tweaks of the trash can location.