In finance this is called price discovery. In the labor market it’s called waiting until someone is one foot out the door. It’s much more expensive to correct the situation once someone has already decided to leave.
Further in some corporations, interviewing for other positions is a bright shiny red flag for that person to be let go or fired. Even if they accept the counter offer.
If I could get the same amount of money from my current job I would probably stay unless I'm sure I would love the other job more. Because when money is a constant, it's either do I want to keep doing what I'm good at, or jump into something possibly different (and riskier).