Machines isolate the muscles that are being exercised. This is an advantage when exercising to rehabilitate an injury or strengthen a specific weakened body part. Machines are self-contained and neat. There are no weights scattered about, creating a hazard and an eyesore. In favor of free weights Free weights are the choice of muscle builders.
Some machines are closer to free weights in their effects, while others are much less effective.
Machines with a weight stack that moves up and down exert an influence that is closer to a barbell. In contrast, machines that offer resistance with thick rubber bands, hydraulic pumps, fancy isokinetic inner workings, etc., seem less able to challenge the muscles to the point of forcing them to change substantially. That's not to say you cannot become considerably stronger by using machines. On the contrary, strength gains can be made on machines, especially early in training. But these gains are primarily because of changes in the nerves that serve the muscles.