It’s inevitable. There’s a high value target and an excess of unemployed, highly educated people in Africa and Asia. My personal experience both as teacher and student is that there is a lot more of that going on than is reported.
When I taught programming and gave out assignments, you can’t expect students to write working programs during an exam, I would often interview them and discuss their assignments with them - I could tell immediately whether it was their work or not. IMO, that’s the answer. Have enough instructors so that they know their students.
Another widespread fraud is falsification of data. Unless you write a paper that gets people’s attention, no one is going to duplicate your experiment to verify your work. In some cases there’s no lab work to be done, psychologists can go out and poll people. Even if it’s lab measurements, you run the equipment, you record the measurements and interpret the data. I know of a couple of Phd theses that were done this way.
Plagiarism was much more widespread before the internet made text searches trivial. Some important people got busted on their PhD thesis which had been written years before.
I once interviewed a student for a position as a Junior Scientific programmer. She had a batchelors in Math and knew FORTRAN. She brought with her a small program that calculated the landing distance of a motorcycle jumping a ramp. I asked her how she would calculate the value of a Sine function if there were no native function. No clue. Didn’t know where to begin. She made it clear that she thought I was being far too tough on her. So I tried this question out on one of our engineers - not really a math guy. He came back with, “Probably some sort of series. I’d have to look it up”. That scores 9/10 points in my book. This was not some arcane question. Series solutions are a crucial tool all over applied mathematics. They get studied in some detail in the standard calc sequence.