Social Security and Medicare tax, or "FICA" is collected by UMass but administered independently by the U.S. Social Security Administration. Non-student U.S. citizens, lawful permanent residents, and resident aliens are subject to FICA tax on dependent service income (i.e. salary/wages).
F-1 or J-1 students and scholars who are nonresidents for tax purposes are not required to pay Social Security taxes if they meet section 3121(b)(19) requirements. In general, those in J-2 status and those in F-1 and J-1 status who have become "residents for tax purposes" must pay Social Security and Medicare taxes, unless they meet section 3121(b)(10) Student FICA exception rules. If Social Security and Medicare taxes are withheld in error you can obtain a refund by following the instructions in IRS Publication 519.
Note: Income tax treaties provide some exemptions from U.S. federal income taxes, but do not generally provide exemptions for FICA taxes.