When you first connected your 3GS to your Mac, you should have been prompted to transfer the backup for your 3G, which is created and maintained by iTunes for each iPhone as the first step during the sync process, and includes the following data.
http://support.apple.com/kb/HT1766
3rd party apps are not included with your iPhone's backup, but should be available in your iTunes library along with other iTunes content such as music, video, and podcasts, which must be transferred to a new iPhone via the iTunes sync process regardless if you select to transfer the backup from an existing iPhone to the new iPhone. No different when purchasing a new iPod to replace an existing iPod or to be used with an existing iPod.
When purchasing/downloading apps with your iPhone, the apps should be transferred to your iTunes library on your computer the first time you sync your iPhone with iTunes after doing so.
If all apps are not in your iTunes library, you can re-download the apps with iTunes on your computer and you won't be charged again for any purchased apps as long as you use the same iTunes account to re-download the apps that was used to purchase the apps originally.