.dmg files organization
The .dmg is the disk image which is mountable like an external file. The value it provides here is that .dmgs are checked for consistency/correctness upon mount, so if the download went wrong you will get notified
The .pkg is the standard format for installable software and usually contains not only the application itself but all the other stuff displayed during installation: ReadMe, legal/license information, optional packages etc.
The .gz is to compress the data and keep the packages smaller on disk (and for download)
.cpio is an archive format similar to tar etc.