I don't think the companies are doing anything special, but rather your phone is smart enough to associate the number with the public information available about them.
On my Android phone, in the Phone app Settings there is an option Caller ID by Google, that can be turn on or off, to show names of people and businesses not in your contacts.