The United States Social Security Administration (SSA) is the agency that issues new SS# after determining the eligibility of recipients through an application and checking documentation. The United States Internal Revenue Service (IRS) is the agency that collects taxes from individuals and businesses, issues refunds, and prosecutes tax fraud. For all practical purposes the two agencies are sisters and work very closely.
The collaborative process works like this: when an employer has employees on payroll, on a quarterly basis the employer will file documents with the IRS about its workforce and make payments to the Department of Treasury. At the end of the year, the employer will submit comprehensive data in form of W-2 and W-3 forms to employees and SSA. Then through the IRS/SSA Reconciliation Process the two agencies make sure that the data processed by the SSA and IRS is the same (that is why if you do not report some income to the IRS or forget to take a deduction for which documents were submitted by a bank, for example, the IRS software will immediately detect it).
It is during this process that if there is a mismatch between a name and other identifying information about the individual (remember all the data that is collected at the time of receiving a SSN?), the SSA and IRS will find out that there is either an error or a crime is being committed. Since human beings can make mistakes (despite the word of caution about getting your taxes right, particularly your SS#), you do get a chance to rectify the mistake, but if there is no response from the individual who has a fraudulent Social Security number or the response is not satisfactory or it is clear that the criminal is an undocumented alien, the matter is referred to the Department of Homeland Security (DHS), which can use ICE agents to catch the alien. In other cases, the IRS agents work with police departments and the FBI to catch the criminals.