The "free" pit-stop doesn't exist any more, especially since the rules were changed last year that meant drivers had to stick to a certain speed when the safety car was on track, I will explain that in more detail later on.
The basic premise of the "free" pit-stop is that under normal circumstances you lose more time relative to the cars not stopping than you would do under the safety car. For example, let's assume a track where the average speed is 100 (doesn't matter if it's kmh or mph) for the lap and the average lap time 100 seconds. If you stopped in the pits let's assume it adds another 25 seconds to your lap time, this means you've taken 25% more time compared to the other cars.
However, if the safety car is out, the laptimes double to 200 seconds, your pit-stop now only adds 12.5% to the average lap as it is the same duration, so the penalty for stopping is much less, but there is still a penalty.
Another example is once everyone is behind the SC and you pit, let's say from 1st place, assuming the SC stays out you would rejoin at the back of the pack. If the pack isn't too large then that's only a lost of around 10 seconds on the track.
With regards to the recent rule changes - in the past the drivers were told they had to acknowledge the fact that the safety car was on track and drive accordingly. In reality they were still driving at pretty close to 100% until they actually caught the safety car up, so laptimes could be close to normal racing speeds at least for the lap or so after the SC was deployed, they would still be catching the SC and it wasn't until they actually caught it that speeds would be seriously affected.
The new rules mean driver MUST obey a speed limit while the SC is on track, this works by forcing them to drive each sector within a certain amount of time, this is checked by telemetry and any driver not obeying this will be penalised. The drivers can see the time on their steering wheel display - so the advantage of pitting under the SC isn't as great as it used to be and vice versa the advantage isn't so big either.
What happened in the last race was simply that Vettel made up around 25 seconds over Hamilton due to his pit-stop and Hamilton couldn't make that time back up when Vettel pitted as he was limited by the new SC rules as to how fast he could go when trying to catch the SC. He did catch up Vettel once they both caught the SC but the damage was done as you can't overtake under SC conditions.