I am a professor with a background in both disciplines (Computer Science & Mathematics). I can direct a good candidate in a few sentences to try a new approach, or read somebody else's published work and try to apply it to a new problem.
This is especially true in Computer Science: I have given a student a basic idea that became a published paper; but it took them a year to code the idea, incorporate it into an existing library, find issues and fix them, run experiments to document its performance and capabilities for a paper, etc.
All of that is a learning tool for them to be able to do original research and justify it in papers (and understand the effort that it takes to fully realize an idea that can be described on a whiteboard in ten minutes). The same is true for mathematics, researching for prior methods, finding the exact citations to make are all tedious and painstaking efforts, few of us have photographic memories, we are lucky to remember the name of the person that invented some technique or first proved a theorem.
In Mathematics we also have the working out of a proof. We may be 95% certain a proof can be made, but figuring out its exact form can be a brain buster that takes a great deal of effort. Think of it as similar to an architect given a drawing of an unusual exterior of a skyscraper. Can this be built? I think so, if I can solve X, Y and Z, which I think are soluble, but I can't say I have a solution for sure until I have a solution for sure.
In the meantime, while my student works on his project and consults with me (at least once a week is my practice), I can use my hours working on something else, alone or in collaboration with colleagues, and hopefully both I and my student get a healthy publication from our collaboration.
The student is not just a slave, however, they become co-authors of the paper and learn how to do this work, and get their contributions to science out there and accepted by the world, to be applied by academics, governments and the world. This teaches them to make a living and have an impact: In both mathematics and computer science, some of these advances can plausibly save lives and raise the standard of living, either by direct use or as a foundation for new applied work in new disciplines.