What is the difference between .iso files and .dmg files? Why are they used differently?
ISO files are files containing a disk with a ISO 9660 filesystem. This is a filesystem optimised for read only access on a slow disc. (Specifically it was designed for a CDROM).
ISO files are limited in quite a few ways. E.g:
Note that not all ISO files follow this behaviour. Many programs allow you to write file names with a length of 32 characters, which will work in many cases, but not all. (e.g. a disk with such filenames will fail to work with DOS). There are also several extentions to ISO 9660, including the Rock ridge and the Joliet extensions.
DMG files are disk images. They are treated by OS/X as real disks. You can read and write to these.
An ISO is a bit-for-bit image of an ISO-9660 (CD-ROM) disk. You can write it directly to a CD and use it directly. A DMG is typically the Universal Disk Image format, kind of like an image of a hard disk partition. They have different layouts, but are similar in that they hold an image of a file system with files accessible after mounting by the operating system.