BAD GODSBERG, West Germany - "In Romania," says 58-years-old Franz Niemevv, "it was like living in a bird's cage and, as soon as the cage was opened, I flew to a free life."

The life for which Niemevv left is, at the moment at least, a sparse one-room flat with a communal basement in this otherwise well-to-do suburb of Bonn.

It is far from his farm in Romania and from the house he had to sell for one-twelfth its value. The proceeds of that sale had to remain in a Romanian bank and he had to leave a married daughter behind.

But his wife and son are with him and, says Niemevv, "I would do it all over again, instantly."

Niemevv was allowed to emigrate because he remains an ethnic German with close relatives in West German, even though his own ancestors migrated from Germany almost a century ago to what is now Romania.

He is part of one of the largest reverse migrations in modern history - the slow, steady stream of German-speaking people flowing into the western half of Germany after World War II scattered and trapped them by the millions in what became Communist Eastern Europe.

They come for many reasons. Some flee from the restrictions of Communists systems and others from the economic problems and low standards of living in the East.

Virtually all say they come in part because it is increasingly difficult to preserve their German heritage in the East and because in many places they are still persecuted because they are Germans.

They sometimes meet with a different kind of insult when they arrive here.

"When we lived in Poland," says a teenage daughter of a recent immigrant, "they called us Nazis. And for a while when we enrolled in schools here, some of the kids called us "Polacks." They looked down on us, even though we were German. Now, it's fading away and, when our father teases us and says he is going to send us back, we say 'never.'"

Giving up homes or farms and at least some security, even in a restrictive society, is still a gamble for people faced with anxiety about life in another society.

Yet, the new immigrants here encounter a government open-arms policy that must rank as among the most generous efforts of any country to reclaim its onetime citizens.

The resettlement efforts appear to have greatly eased the adjustment for most. Last year more than 44,000 ethnic Germans, almost three times the 1975 level, returned here.

People are now coming from Poland at the rate 2,500 a month, largely under terms of a 1975 treaty with Warsaw by which Bonn Provides about $900 million to Poland in economic aid and credits.

Russian citizens have been arriving at about 600 a month for the first four months of this year, a level slightly below the record rate of 9,700 who came last year. More than a thousand Romanians a month have come thus far this year, the highest flow ever. Much smaller numbers come from Czechoslovakia, Hungary and Yugoslavia.

Another 15,000 a year come here from East Germany, mostly elderly pensioners whom the East Germans are willing to let out, plus political persons who are ransomed by the West German government. A handful still manages to escape through the minefields and barbed wire at the border.

Aside from the Polish treaty, many of the immigrants believe the stepped-up flow, especially from Romania, is a result of the Helsinki agreements, signed by 35 countries in August 1975, pledging greater freedom of movement and reunification of families among the people of Europe.

The approach of the Belgrade conference, opening Wednesday, to review implementation of the Helsinki accords is also held to be a factor, especially as East European countries seek to project an image of compliance. Adapting to the Motherland

For FRANZ Niemevv, there is not much hope of finding a job at 58 and with rather specialized farming experience. But Niemevv was granted the equivalent of German citizenship as soon as he arrived in February. He is a member of the Volksdeutsche, German minorities who lived outside the German state before World War II.

Thus, he gets the same 68 per cent unemployment pay as a native German worker, in his case about $400 monthly. His rent in the tiny flat, which he shares with his daughter, is $16 monthly for the two.

When he first applied to leave in mid-1975, both his children lost their places in Romanian universities. Now one daughter is in school here and his wife, who came before him, has a full-time job. They will leave the one-room apartment for a bigger one this summer.

Of all the hyphenated nationalisties coming here, the Romanians are the one who fit in most easily. In Romania, they were allowed to maintain German schools, langua and communities, although the Romanians are now cracking down on this, Niemevv says. They have no language problem when they arrived here and frequently are highly educated.

Nextdoor to Neimevv, in another tiny one-room flat, lives Gerd Lovitzny, 42, a Polish-German immigrant who came in August 1976, as a so-called Reichsdeutsche . These are Germans who lived in what was German territory until it was annexed by the Soviet Union in Poland's name after the war.

Lovitzny, who lives with two daughters in the one room, applied to leave 11 times over a 10-year period before his emigration was allowed. He calls living here rather than Poland "the difference between heaven and earth."

"For a German, there is just no future in Poland," he said. "I worked in one firm without a raise or promotion."

In July, Lovitzny starts work at a metalworking plant in Bonn, where the plant manager says he likes to hire Poles rather than natives-born Germans "because they work harder and are more obedient."

Lovitzny came to German by plane, which means he could take only suitcases. Like the others, his fare was reimbursed by the German government. He was paid about $1,000 as partial compensation for household goods he had to leave behind.All of this, plus state-subsidized temporary housing, comes under what Bonn calls the "equalization of burdens" for displaced Germans.

Besides his monthly unemployment check, he got an extra 18 per cent for attending language class to brush up the German he was unable to use very often in Poland.

While older Poles adapt most easily because they lived on German territory before and during the war, adults under 40 and children frequently cannot speak the language and that is a major frustration for them in their first year here.

The expense of living in one of the most expensive areas of high-priced West Germany does not bother Lovitzny, at least so long as he hasn't much rent to pay.

"Sure it is expensive here. But in Poland you can have money but there is nothing to buy. There are scarcities of sugar, meat, nice clothing and consumer goods. So what is better?"

A Soviet-German immigrant also disputes conventional economic: "No it isn't really expensive here for us. The wages are very low in the Soviet Union and the price of consumer goods very high. So in Germany, we actually can afford more real things." The Russian-Born

A FEW MILES from here, in the village of Duisdorf, 14 German-speaking Russians share five rooms in another state-subsidized apartment house.

The Soviets, with generally fewer skills, less education, and children raised with a different alphabet, have the most problems adjusting here. But they seem to make up for that in warmth and enthusiasm.

The Duisdorf 14 are all related and everyone works except schoolchildren and 79-year-old black-kerchifed baba who sits in the corner and supervises the maintenance of a spotlessly clean living room.

The three men in the family found work quickly as metal workers, each taking home about $520 monthly. A daughter-in-law earns about $680.

Two years after they arrived here, they are building three small homes, doing much of the work themselves. Elsa Schwartz, 52, who does most of the talking, says they tried for five years to get out of Russia, where an estimated 1.8 million ethnic Germans still live. According to official Bonn estimates, hundreds of thousands of them want to leave.

After Schwartz's children demonstrated in front of the new German embassy in Moscow, "they were arrested and we were treated as spies and collaborators." Finally, they were allowed to leave when they paid 500 rubles ($650 at official rates) for travel documents.

They were given a partial refund when they signed a statement saying they would not criticize the Soviet Union after they left.

(Schwartz is not their real name. Niemevv left Romania under the same no-criticism requirement and his name, too, is changed here.)

Elsa Schwartz is a vivacious woman, still excited about the Red Cross coffee-and-doughnut reception she got when her family landed in Frankfurt in November and about the Red Cross' diligence in following the flight of the plane as it was diverted by fog from one airport to another.

"We were not at all used to being treated as equals, as human beings. In Russia, we were treated badly. We could never feel like Germans. Even young children were called fascists," she said.

The Schwartzes have no relatives here, all of the family having been born in German colonies in the Soviet Ukraine or, after forced exile, in Siberia. But Mrs. Schwartz explains, they were able to convince a few friends here to serve as "cousins."

Despite government efforts, however, the resentment of some native Germans toward the newcomers sometimes runs high.

The big new influx of Poles began in late 1975, at a time when German unemployment was running at record post-war highs of almost 1.5 million. A public opinion poll early last year showed that 34 per cent of the interviewees preferred that their pre-war landsmann go back to Poland.

Much of this, officials say, now seems to have quieted down with unemployment dropping to around 1 million.

Actually, 30-35 per cent of the newcomers are unemployed for the first year or two. But a government survey shows that, as of last September, the overall unemployment rate for immigrants who arrived between January 1971 and September 1975 was only 5.6 per cent, slightly above the 3.9 per cent national average.

Another survey showed that, 650 families who arrived during one year in one of the West German states, virtually all moved out of temporary quarters within two years, 21 families eventually bought their own homes and 192 their own cars. The Magnet of the East

THE NEWCOMERS uniformly and bitterly cite the attempt at suppression of their "Germanness" as the reason for wanting to leave Eastern Europe today. And that is one of the great ironies of the new reverse migration.

For centuries, the Germans were not only the great colonizers of Central and Eastern Europe, but in many places they were initially welcomed by 17th and 18th Century Russian czars and Austro-Hungarian emperors as skilled and cultured settlers who could contribute much to less advanced societies.

There was no drive to assimilate the Germans in those days, no attempt to force them to change their ways. On the contrary, they were many ways a protected minority.

Aside from frequently attractive offers to resettle in the East, however, the German migration eastward form medieval times through the pre-World War II years is rooted in the combination of three characteristics that have long been associated-fairly or not-with German attitutes. One is a sense of superiority.

"In East Europe, the minorities divide into those with superiority feelings and those with feelings of inferiority. The Germans and Hungrarians were clearly the elite minorities. The Germans was properous. frugal, skilled workers and they regard themselves everywhere in Eastern Europe as a special kind of superior citizen," said one Western historian.

Mixed into this centuries was a general-German disdain for Slavic peoples and cultures to the East and the impetus of Drang nach Osten , the feeling that Germans must always look first to the less populated flatlands of the East, with their "inferior" populations, as the natural place to gain lebensraum , or living room.

In American, one historian here notes, "Horace Greeley told pioneers ot "Go west, young man." German publishers traditionally have said, 'Go east.'"

So millions of Germans went east over the last 700 years or so. And, they had their ups and downs.In some places, such as western Czechoslovakia and through much of the Austro-Hungarian empire, German culture thrived and in fact dominated many areas of life. The surgence of the Polish Kingdoms beginning in the 15th Century, on the other hand, dealt setbacks to the Germans.

During World War II, many German-speaking families with deep roots in Russia were treated as fifth columnists and shipped to the eastern provinces. Elsewhere in Eastern Europe during the war, there were numerous tales of individual German-Poles or German-Czechs who opposed Hitler's policies, but there was vastly more support than opposition.

Not surprisingly, the resentment released in the war's aftemath was massive, as was the fear of the German population in the East.

Millions fled westward in the war's closing months, away from the paths of advancing Soviet armies. Afterward, millions more fled or were expelled from their homes in Poland's former German territories.

All told, it is estimated that some 16 million people, about 3 million of them from what is now East Germany, came west between 1945 and 1950. Many of those people had long histories in these Eastern lands and many, like people all over Europe, were bewildered victims of war.

Much of this massive population transfer took place under the agreement signed at Potsdam in 1945 by Truman, Churchill and Stalin. It called for the transfer to be carried out in "an orderly and humane manner." But some 2 million of these reverse immigrants never made it. What About the Rest?

SINCE 1950, when the East began to seal itself off more effectively and East Germany took steps to stem the flood of departing workers, the number of emigrants has dropped sharply.

Eight hundred thousand more people have come since 1950, but almost half of this figure is represented by German-Polish families who continued coming to the West in large numbers until 1966.

Thirty-two years after war's end, it is estimated that anywhere from 280,000 to close to 1 million ethnic to 420,000 remain. Obviously, not all of those want to leave; how many would like to is impossible to estimate.

In the past decade the flow has been spordic; at times, the pace of emigration has been an accurate barometer of overall East-West relations.

The upsurge of emigration in the last two years and the concomitant hope of further emigration helps explain why West Europeans in general, and Germans in particular, are sometimes more cautious than American leaders about making statements on the human rights issue. There is concern that negative reactions in Moscow could threaten the pace of family reunification.

Germany "can afford less than other governments for its part to provoke setbacks or bear the onus of provoking such setback," Chancellor Helmut Schmidt said recently.