WASHINGTON (AP) — The Supreme Court agreed Tuesday to will decide whether student doctors are students or employees when it comes to collecting Social Security taxes.

The high court will hear an appeal from the Mayo Clinic of Rochester, Minn., and the University of Minnesota, which says the IRS shouldn't have made it collect the taxes.

Medical residents, who are studying to be doctors, routinely work in hospitals and pay income taxes. But Mayo Clinic officials say residents fall under a Social Security tax exemption for student employees whose work is part of their education.

The Treasury Department changed its rules to take away the student exemption for medical students who work more than 40 hours per week. The Obama administration said that Social Security taxes for medical residents can be as much as $700 million a year.

Mayo Clinic officials want the court to overturn a federal appeals court ruling and restore the student exemption for medical residents.

Universities, medical schools and hospitals backed Mayo, saying the issue is an important one and that federal appeals courts around the nation have reached differing decisions regarding medical residents.

Argument will take place in the fall or winter. Supreme Court nominee Elena Kagan would not take part in the case if confirmed because she signed the government's brief defending the IRS' position.

The case is Mayo Foundation v. United States, 09-837.