Depends on the situation.
Machines are better for newbies who have no personal trainer to teach them proper form. Also for older folks who have never exercised and need to gain confidence. And of course for rehab.
Free weights are certainly better for those who have been taught and are capable of proper form.
Bodyweight/functional lifting, IMO is the best! In my lifting career (personal trainer), I have progressed from machines, to free weights, to bodyweight. All have their place.