This is possible via the Google Apps Email Audit API[1], which is accessibly only by paid Google Apps accounts. The API submitted export request takes usually several hours to complete and results in a series of large mbox files (1 GB chunks I think) containing the entire mailbox, including trash (if requested). However some meta information such as labels/folders is not present, but the results can easily be concatenated into a single mbox file containing the entire contents of a Google Apps email account.
Seriously, it's an absolutely perfect match for exporting everything, and it's easy to set up, and you get it in the format of your choice. Infinitely easier than having them support only formats they have time to write exporters for. It's also easily resumable, unlike the 8GB zip file I'd otherwise have to download.
IMAP can be used to download the raw message bodies. hierarchical structure (aka threading) comes from the parsing of Message-ID, References, In-Reply-To MIME headers contained in the bodies.
I mean directories. GMails IMAP interface maps each tag to a directory but that is not exactly the same. Esp. when your extracting algorithm doesn't know about this, you end up with a lot of duplicates.