UMass staff can accomplish that, the lawyers wrote, by making sure that prisoners with HIV take each dose of medicine when they get to the front of the med line.

The number of inmates who take their antiretroviral medications for HIV through the Keep On Person program as prescribed “fell below the optimal rate strived for by the institution,’’ the lawyers wrote in May 2009. UMass is seeking a rate of more than 95 percent, they wrote.

Diane Wiffin, a spokeswoman for the Department of Correction, said prison officials will not comment on pending litigation. But lawyers for UMass Correctional Health, in response to a similar suit filed last year in state court and later withdrawn, wrote that the contractor made the change to improve adherence to HIV medication regimens.

“The removal of HIV medications from the Keep On Person program is callous and extremely shortsighted, as patients who refuse or are unable to go to the med line, or who miss doses because of the chronic defects in the med line process, will become more sick,’’ said the suit, which was filed by five prisoners with HIV and seeks designation as a class action.

Waiting in the line frequently enables other inmates and correction officers to identify who has the virus that causes AIDS, which often carries a stigma, says the suit. It also exposes inmates with weakened immune systems to other sick prisoners, often delays the dispensing of dosages to treat the virus, and has caused some with HIV to stop picking up their pills, resulting in worsening symptoms and even cases of AIDS.

As a result of the change, HIV-positive inmates who took their medicine in the privacy of their cells now must go to an infirmary “med line’’ daily, often several times a day, with scores of other inmates who receive single dosages of other medications, says the suit. About 200 to 300 inmates get medication for HIV in the prisons.

The suit, which is expected to be filed today in US District Court in Boston, says the prison system and its medical provider removed HIV medication in February 2009 from the list of prescribed drugs that inmates have long been allowed to keep in their cells under the so-called Keep On Person program. UMass Correctional Health, an arm of the University of Massachusetts Medical School, has a contract to provide medical care to prisoners.

Massachusetts prisons have changed how they dispense medication to inmates infected with HIV in a calculated effort to discourage them from taking life-saving drugs that cost the state millions of dollars a year, according to a federal civil rights lawsuit.

Lawyers for Prisoners’ Legal Services, the Boston-based legacy advocacy group representing the five prisoners, contend that the state has given a host of explanations for the policy change but that the real reason is cost.

Antiretroviral medications account for at least 20 percent of the state’s overall annual spending on medications for prisoners even though such inmates make up only about 2 percent to 3 percent of the prison population, the suit said. The state spends about $15 million a year for all medications for prisoners, the lawyers said.

“While UMass and the DOC cannot simply deny patients their medication, they can and have erected barriers to access in order to discourage adherence,’’ said the suit by the prisoners, four of whom use pseudonyms to protect their identities.

For at least 15 years until the change, the Massachusetts prison system had an enviable record for its medical care of prisoners with HIV and AIDS, according to Joel H. Thompson, a staff attorney for Prisoners’ Legal Services.

Each prison had a case manager who closely followed the progress of HIV-positive inmates, Thompson said. Infectious disease specialists from Lemuel Shattuck Hospital Correctional Unit would visit inmates at prisons to treat them. And as a result of the Keep On Person program, prisoners could pick up 30-day supplies of HIV medication in blister-packs that they stored in locked containers in cells.

Some medications have long been excluded from the program because they pose a security risk and can be abused, including drugs that are injected, narcotics, and mental health medications, Thompson said.

In November 2008, UMass unexpectedly announced that patients receiving HIV medication would get only 15-day supplies, according to the suit. Then in early February 2009, UMass withdrew only those medications from the Keep On Person program and required prisoners with HIV to go to med lines at each prison.

At least three of the plaintiffs say other people in prison have discovered their HIV status as a result of remarks made by UMass staff at med lines. Several of the plaintiffs also say they have missed dosages because they were too ill to wait in long lines that sometimes snake out of prison buildings or because correction officers failed to call them to med lines.

Dr. Thomas Garvey, a primary care doctor who treated prisoners with HIV and AIDS on the prison ward at Shattuck until he left the hospital in December, criticized the exclusion of HIV medication from the Keep On Person program in a Globe interview Friday.

“From a medical and public health standpoint, yes, it’s a bad idea,’’ he said.

Lawyers for UMass, however, wrote in response to the earlier suit that the change in policy is intended to improve the health of prisoners with HIV. With the daily med lines, they argued, UMass staff have more contact with the prisoners than they did before. They also asserted that the process enhances, not undermines, privacy by reducing the likelihood that other inmates will find or steal HIV medication brought back to cells.

Jonathan Saltzman can be reached at jsaltzman@globe.com.

© Copyright 2010 Globe Newspaper Company.