You definitely can do this, and your training makes a big difference. It’s not completely dictated by just how much you eat. You still need to eat well. It’s more dictated by whether you’re doing training for power or hypertrophy. And of course, how much cardio your doing.
If you’re playing a lot of basketball in addition to your weighttraining, you will not gain too much size anyway because of all the cardio involved in basketball.
There are tons of athletes who want to do exactly this. Wrestlers, gymnasts, runners. I know this happend for me training for track. I added a lot of strength and power, only 10 lbs of bodyweight in college, and my speed and flexibility all increased. And that didn’t even affect my size too much because a lot of my weight was just some denser muscles. I didn’t even change a jacket size or anything.
One thing that is very important to do during all this training is to maintain your flexibility and mobility. Aside from the weightclass issue, a main reason most people want strength and not size is because they don’t want to lose flexbility and be less mobile.
Also, there’s a perception that the heavier weight will slow people down. This is not true if you are doing the right exercises. If you’re doing full body exercises like squats, deadlifts, and Olympics, then any muscle weight you gain is also going to be muscle weight that will increase your speed above your gained weight.
This is because your weight gain will be in muscles aiding in moving your body, like hips, thigs, core, etc. If you go into the gym and only do arms and upper body, then yes, that might slow you down on the basketball court if you become top heavy.
So don’t shy away from weight training. You definitely still need strength. With a lot of basketball playing though, you’re not going to put on much weight at all. Just make sure your weighttraining is full body and strength/power based.