Just like any other hard drive, the hard drives in the iPod are rated so that 1GB=1,000,000,000 bytes. The problem is that this is not actually true, so the actual number of GB you get is smaller. Here are some estimated true iPod capacities:
5GB iPod: 4.6566GB
10GB iPod: 9.3132GB
15GB iPod: 13.9698GB
20GB iPod: 18.6265GB
30GB iPod: 27.9397GB
40GB iPod: 37.2529GB
Note that the amount of space you get has nothing to do with what generation iPod you have. It is entirely dependent on the rated size of the hard drive. So a 3G 40GB iPod is going to have the same capacity as a 4G 40GB iPod.