It all depends on how you raise the dog. You don't chain your dog, you have allowed him to socialise with other people and animals. As a result of this, your dog is confident and curious. When he runs after someone, he is not trying to run away from you, he wants to explore that person. He will sniff and will come back. He may also be friendly because when somebody comes on your door, you greet them. Your dog learns from that and he also understands that not every stranger is hostile. That's the reason why he doesn't bark on them.
On the other hand, if an owner chain his dog all day, doesn't allow him to know his surroundings, the dog is most likely to feel insecure and he may bark all day on almost everyone passing by. Such dogs can even be dangerous as well.