A new study suggests that most young gay men in Mexico City would pledge to stay H.I.V.-free, attend a monthly safe-sex talk and take regular H.I.V. tests to prove they were uninfected — all in return for just $288 a year.

Most male prostitutes would make the same promise for $156 a year, the study found.

Because each person receiving H.I.V. treatment costs Mexico’s public health system up to $7,000 a year for drugs alone, payments that encourage men to stay uninfected could be a bargain, the authors argue.

The study, done by researchers from Brown University, the University of California at Berkeley and Mexico’s national public health institute, was published online by The European Journal of Health Economics.

Although other countries have tried programs that pay people for good health behavior, like taking children for checkups, the authors believe their study was the first to pinpoint a specific dollar value that would ensure cooperation from 70 percent of a risk group — in this case, young gay and bisexual men, who have very high H.I.V. infection rates and are the drivers of Mexico’s epidemic.