Updated

The Supreme Court on Monday seemed divided on whether student doctors are students or employees when it comes to collecting Social Security taxes.

The high court on Monday heard arguments from the Mayo Foundation of Rochester, Minn., and the University of Minnesota, which says the IRS shouldn't have required the Mayo Clinic to collect the taxes on medical residents.

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

The Treasury Department took away that dispensations 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.

"How do you draw the line between a student who is working and a worker who is studying?" Justice Sonia Sotomayor said.

Mayo's lawyer, former solicitor general Theodore Olson, argued that the IRS' decision to say anyone who works over 40 hours a week at a hospital can no longer be classified as a student was arbitrary and capricious.

"If you're doing it for 39 hours, you are," Olson argued, "but if you do it for 41 hours, you aren't?"

But Matthew Roberts, an assistant solicitor general, argued that the IRS should have the authority to decide who can be counted as a student and who cannot. "If you're working full time, you're an employee and not a student," Roberts said.

Justice Elena Kagan did not take part in the case because she signed the government's brief defending the IRS' position.

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