From Social Security website:
How State And Local Government Employees Are Covered By Social Security And Medicare
SSA Publication No. 05-10051, April 2012
Do you work for an agency of a state or local government? Unlike workers in the private sector, not all state and local employees are covered by Social Security. Some are covered only by their public retirement pension program; some are covered by both public pensions and Social Security; and some are covered by Social Security only.
When it began, the Social Security program did not include any of these employees. Over the years, the law has changed. Most employees have Social Security protection because their states and the Social Security Administration entered into special agreements called “Section 218 agreements.” Others are covered by a federal law passed in July 1991 when Social Security was extended to state and local employees who were not covered by an agreement and were not members of their agency’s public pension system.
Except for workers specifically excluded by law, employees hired after March 31, 1986, also have Medicare protection. States also may obtain Medicare coverage for workers not covered for Social Security who have been continuously employed by the same state or local governmental employer since before April 1, 1986.
http://www.ssa.gov/pubs/10051.html
They can't. But they do. They are called double dippers. :-(