Companies recognize (and generally accept) that employees will follow the money. Few industries care about an employee being "committed" to his/her job beyond the employee's willingness to work in exchange for a paycheck. (Though based on anecdotes on this board, this may actually be a problem in the software industry...)
Generally, a counteroffer indicates that the company thinks an employee is worth keeping. In most industries (i.e., except possibly the software industry), a company will not make a counteroffer to an employee they do not want to keep around for the foreseeable future. If an employee is valuable enough to justify a counteroffer, he/she is not easily replaceable (for various reasons, including talent, knowledge, familiarity with the company's processes, systems, etc.). If the employee is easily replaceable, the company will simply deal with the temporary loss of the employee while they recruit a replacement. Either way, the math does not add up to justify retaining an employee with a counteroffer while also spending the money to recruit (and bring up to speed) a replacement.
Fundamentally, if you have to quit to get a raise, it's not a great company to work for.