Doctors do prescribe pills in triple digit amounts, as Rovey mentioned. I have had painkiller prescribed in 100's myself.
Also, it seems like you are assuming he obtained them legally - i.e. from a doctor, which if it were the case he wouln't have gone to court. He probably bought 300 or so from a dealer. Again, it just isn't far fetched for a pill popper to have a few hundred pills that are for themselves, and not intended for distribution.