The PI wants to pay you for 20 hours/week of work and get 40-80 hours/week of work out of you.
If you get a part time job, or any other commitments really, you won't be available to work 40-80 hours on the stuff the PI wants you to do.
A really bright student working 40-80 hours/week on the PI's projects will both help the PI advance their own career, get the things that the PI wants done done, and is (very slightly) more likely to be a student who graduates and goes on to become a useful contact for said PI in the future.
They don't want to pay what a really bright person who is competent in computer science can earn outside of academia on a 40-80/hour schedule. Instead, they pay 18$/hour for a fake 20 hours/week 50 weeks/year and hope for 40-80 hours of work.
Initially, you may be spending the extra hours/week on classroom instruction, but that tends to fade rapidly.
This is similar to the internist trap in other industries like publishing. Underpaid or unpaid interns at the start of their career are expected to donate their effort to produce things of value to prove themselves. A percentage of those are then invited onto the next tier (postdoc), where they are still underpaid (after all they compete with the previous tier somewhat) in precarious contracts for a period of years.
A percentage of those are then invited onto the next tier (tenure track in the academic case). Some percent of those are still winnowed out, with the remaining fraction of a fraction of a fraction of a fraction going on to get tenure. Most of those who get tenure are at some small university with limited research opportunities, and only a small fraction end up being the kind of professors that are imposing the above constraints.
With tenure, your promotion/salary increases are then tied to your ability to do the same to the next generation. If you can convince dozens of new grad students and postdocs to work 40-80 hours/week on your research you'll be co-author on all of their work. When they graduate, they'll cite your papers, granting them a high impact factor.
So why does the PI frown on outside work?
There is an oversupply of overly optimistic people who want to be academics, caused by the lottary nature of the system and the fact that each layer is selected from the people who "won" the previous layer. They can use this to convince you to work extremely long hours for little pay. Those who do not buy in are not as useful to the PI.
Or, because the PI can.
Now, if you really want to become an academic, or really want to focus on your research problem because you want to solve it, this is in your long-term best interests as well. A chunk of the payoff for the PI is having those students who graduate and go on to do great things, and by putting in the hard long hours you are more likely to make it out the other side of the pyramid intact.
Still unlikely to make it out, but less unlikely.
Now, I know of at least one Computer Science grad student whose PhD project (with their supervisor's work as well) turned into a commercially semi-viable startup, which then sold for a few million dollars. They then semi-retired and started working on fun projects (what others might call work) outside of academia. Being paid enough to eat while working on such a project may be economically reasonable.