I have read that the mid drive motors are better than hub motors but not sure why and they seem a lot more expensive.
As others have mentioned, both have advantages, with hub motors generally being cheaper, while mid-drives generally giving higher torque and efficiency when climbing hills when you use low gears.
However, perhaps one of the key differences is not in the drive itself but in the sensor type. Mid-drive motors generally come with torque sensors which measure how hard you are pedaling and multiply the effort. Thus, if you are pedaling lightly they will provide a gentle assistance, while if you are pedaling hard they provide more force. This gives a very natural feel. Meanwhile, hub motor bikes generally come with cadence sensors that detect when you are pedaling at all and apply the same force if you are. I.E. it is more of an on/off feel. Also, there is usually a delay for a cadence sensor based bike to detect you pedaling and activate (or deactivate) the motor, while torque sensor based bikes are more instant. Of course, it is possible to get a hub motor + torque sensor combination.
Finally, not all cadence sensor based systems are created equal. Some are speed based, which try to get you to a certain speed based on the assistance level you program.* The Magnum Metro is one example. Thus, even if you are on a low assistance level you will still get a hard (and IMHO disconcerting) shove when starting out. Then, as you accelerate towards the target speed the assistance is reduced and zeroed above that speed. It is sort of like a car that always has cruise control active. Others, like the Rad City, take a constant amount of power at each assistance level. Thus, you get a gentle push on low levels and a harder one at higher levels. While not as natural as a torque sensor, this is still somewhat natural.
* If you are technically inclined, you can see
https://www.ebikes.ca/tools/simulator.html for torque vs. speed curves. Varying the throttle gives you an idea of what different assistance levels are like.