BRAZIL SEEMED for many years to be a country that had learned to live with high inflation and like it. Everything, after all, was indexed to the inflation rate -- wages, prices, mortgages, the works. But, it turns out, Brazilians had growing doubts about it. No system of indexation is ever entirely neutral and fair. In Brazil, indexation was skewed in favor of the well-to-do and tended to redistribute income upward. This year the inflation rate has been startlingly high even in Brazilian terms -- something like 500 percent a year, and rapidly rising. Last week President Sarney imposed a sudden and dramatic plan to stop it at one stroke.

Like Argentina last year, Brazil has now frozen wages and prices, and introduced a new currency. There is no doubt of the strength of the public support behind this initiative. Angry demonstrations have broken out at stores that tried to raise prices, and thousands of citizens have reported violations to the authorities.

The Latin American right frequently charges that democracy is inherently unreliable in money matters and biased toward inflation. In Argentina last year, and now in Brazil, events suggest precisely the opposite. For two decades military governments in Brazil tolerated an inflation rate fluctuating between 20 percent and 100 percent a year. By the time early last year that the generals turned power over to an elected president, it was well over 200 percent.

When that president died before his inauguration and Mr. Sarney inherited the job, there was a period of uncertainty. The impulse was to push for economic growth and not to worry about the consequences. The Brazilian economy grew a phenomenal 7.5 percent last year, but prices were spinning out of control. There will be congressional elections next fall, and it was pretty clear that they would turn out badly for a government that couldn't deal with inflation. The generals never tried anything as daring or drastic as President Sarney's new policy. And it was the voters who pushed him into action.

While Brazil is now following the Argentine example, it has several important advantages in comparison with its neighbor. While Argentina is still in a deep recession, Brazil starts this battle with the momentum of a boom behind it. Brazil has resources unmatched in Latin America. Measured by GNP, its economy is now the world's eighth largest.

But the two countries also have much in common. A year ago both thought that inflation was a nuisance that they could ignore while they turned their attention to growth. Since then, both have changed their minds.