There are too many people doing the old 10" Oscar can't go in a 10g tank argument.
The rule applies to smaller fish for the most part. And you have to think, obviously, but not even too hard. For example, I wouldn't put 40 dwarf hatchetfish, who would all fight for the surface area of the tank, in a 40g aquarium. Or say I really liked pygmy corydoras. That tank won't fit 40 of those either. You have to evenly fill the water column. A tank evenly spaced out can fit far more fish than a tank with heavily populated regions.
Waste is also a big deal. One of the other myths you might here is that bottom feeders don't count. They do. Don't ever try to argue that your pleco doesn't contribute to the waste produced in your aquarium. Also, a large fish is usually messier in feeding habits than a smaller one. That's right! Food waste counts too! They also produce more poop.
The previous two ideas addressed use of the water column and waste. The next is oygen. One popular tank design is a tall tank. Unless you are dead set one one of these, don't buy one. They have less surface area which allows for less dissolved oxygen in the water. This means less fish. A 20g upright tank can probably only hold as many fish, and the size of fish you would keep in a 10-15g aquarium, if that. On the topic of upright tanks, they also make it difficult for a fish that inhabits a specific level of water to get a good swimming area. Most fish inhabit the top and bottom, the top and middle, or all three levels. Some fish however are meant exclusively for a certain level. Catfish in an upright tank have less space to patrol since they never leave the bottom.
Then, you have to consider the length of the fish. Like is has been pointed out, a large fish can't live in a small tank even if a rule says it can. There are so many rules for stocking but using the 1 inch per gallon rule, and not one brain cell worth of common sense, you could keep an oscar in a 12 gallon aquarium (assuming max length=12"). And a 40g tank should easily take a 36" clown knife, with four gallons to spare. However when purchasing a large fish, you need to take into account width of the tank. Can the fish turn around? Width should be at least the max length of your fish, and in nearly all cases, more (eels can turn easier than a gar for example). Length of the tank. Your fish should have plenty of swimming space.
Filters and aerators can help with stocking levels, but only a little. Using an upright 20 for example. First decrease fish total from 20" to 14" because of the tank type (upright=less dissolved oxygen and less swimming space). Adding a filter meant for a 30g and an aerator only brings you up to about 16" in that tank, and they would have to be small fish, including 3-4 corydoras to occupy the bottom and use up 6" of the total.
End point I think is to be honest with yourself. Is it fair to keep that many fish in a small permanent living space? As it is aquarists don't fill a fish's wild needs. In the wild an oscar will occupy a territory of 3' by 3' by 3'. That is 9 cubic feet of water and more than is ever supplied to them. They do just fine in less, but it is something to think about.