Sometimes the stunting happens in the very early fry stages, if the fry were kept in an overstocked, poorly maintained tank....So it could be too late after one purchases such fish. The good news is, size and live span aren't directly related so a fish that was initially stunted, has the prospects of living its life to full potential....although it will not grow to the biggest possible size for the species.
But I agree on the food. There's a misconception that a variety of live/frozen foods is better than pellets....although the truth is the opposite. Pellets are nutritionally the best food one can give their fish, providing one is feeding them high quality pellets..