The secrecy of counteroffer benefits the company, as if it becomes known that a counter is your quickest means to a raise you can be sure others will follow suit. But that secrecy also has some benefit to the person who accepted a counter, as any potential questions about your loyalty or (in some situations) your perceived willingness to abandon the team during a crunch time won't be exposed and the accepter can continue business as usual to a degree.
They might also feel they will be taken as a more skilled candidate if they can quote a high current salary, enabling them to score a better role at a better next employer. That might seem counter-intuitive, but if you know you are under market, people selecting employees for quality over price will wonder why.
A counteroffer doesn't change whatever conditions about a job made you leave, be it unfulfilling work, coworkers, a bad environment, long commute, etc. - unless your only concern about the job was being underpaid, which is likely far rarer.