Firstly, the amount of waste a fish will produce is primarily based upon the mass/volume of the fish. Consider that a 4 inch streamlined, torpedo-shaped rasbora will not be producing the same amount of waste as a rotund, beer-bellied 4 inch molly who is in a late-term pregnancy.
Secondly, as noted in the 1st post, the one inch per gallon rule becomes very silly in the limit of large fish. 20 one inch fish (like small tetras) can be very happy in a 20 gal tank, but obviously one 20 inch fish will not.
Thirdly, the species of fish enters into consideration. Fish from rapidly moving, highly oxygenated waters will require more water per fish than fish from slow moving stagnant ponds. This is where research becomes necessary. Also, some fish are very territorial. A 5 inch fish may claim much more than 5 gallons as its own personal space.
Finally, the fishkeeper's caretaking habits can change the balance as well. If you commit to increased water changes and caretaking, and you 'over-filter' your tank, you can get away with overstocking. But this is only recommended for the more experienced fishkeepers. Likewise, if you want to be lazier, you can plant your tank to help process the fishs' pollution but that requires an aquatic green thumb so-to-say. There are whole other issues for keeping aquatic plants alive.
Many, many factors that "one inch per gallon" cannot take into account. It is just a starting point, and a good place to help newer fishkeepers not run out and purchase as many fish as can fit in a small tank. To be completely accurate, all the above factors, and maybe several I have not even considered, need to be taken into account. Whatever the result will be, it will not be as catchy as "one inch per gallon" which again, is only a starting point.