The Supreme Court ruled 5-to-4 yesterday that a housing ordinance violated the Constitution by making it a crime for a grandmother and grandson to live under one roof.

The decision gave a poignant victory to Inez Moore, 63, a frail, arthritic widow who owns a home in suburban East Cleveland, Ohio.

Living with her are two grandsons who are first cousins, John Moore Jr. and Dale Moore Jr., and Dale's father.

Under a ordinance passed by East Cleveland, a dwelling unit can be occupied only by members of a single family. The law defined "family" to exclude John, now 10, who had been taken in after his father died. John became an "illegal occupant," according to a notice of violation issued in 1973.

The grandmother, who had cared or John for eight years, refused the city's demand to comply with the ordinance by removing him from her household.

Instead, claiming that the ordinance unconstitutionally deprived her of her liberty, she began a legal battle. She lost in every court in Ohio that played a role in the case. Along the way, the city field a criminal charge that led to a five-day jail sentence, which was stayed.

Finally, she turned to the Supreme Court, where Edward R. Stege Jr., a Cleveland Legal Aid lawyer, argued her case.

The city defended the 1966 ordinance partly by citing a 1974 Supreme Court decision that communities can use their zoning powers to define "family."

"But one overriding factor" sets the Moore case apart, justice Lewis F. Powell Jr. wrote in the opinion for the court. The ordinance involved in the 1974 decision "affected only unrelated individuals," hes aid. "It expressly allowed all who were related by 'blood, adoption, or marriage' to live together" and it promoted "family values."

In contrast, Powell wrote, "East Cleveland . . . has chosen to regulate the occupancy of its housing by slicing deeply into the family itself. This is no mere incidental result of the ordinance. On its face it selects certain categories or relatives who may live together and declares that others may not. In particular, it makes a crime of a grandmother's choice to live with her grandson in circumstances like those presented here."

For the majority, the crucial question was whether the ordinance advanced or protected governmental interests important enough to warrant its intrusion into family living arrangements.

The city's interest - preventing overcrowding, minimizing traffic and parking congestion, avoiding an excessive financial load on the schools - are "legitimate goals," Powell acknowledged. But, he said, the ordinance "serves them marginally at best." He went on:

"Ours is by no means a tradition limited to respect for the bonds uniting the members of the nuclear family. The tradition of uncles, aunts, cousins, and especially grandparents sharing a household along with parents and children has roots equally venerable and equally deserving of constitutional recognition . . . the Consitution prevents East Cleveland from standardizing its children - and its adults - by forcing all to live in certain narrowly defined family patterns."

In a concurring opinion, Justice William J. Brennan Jr., joined by Justice Thurgood Marshall, said the Constitution does not permit "white suburbia's preference" for the nuclear family to be imposed "by government upon the rest of us . . ." Justice John Paul Stevens, concurring in the judgment, termed the ordinance an impermissible restriction on the plaintiff's "right to use her own property as she sees fit."

A fifth Justice, Harry A. Blackmun, joined the majority without filing a separate opinion.

Dissenting, Chief Justice Warren E. Burger said he didn't have to reach constitutional issues because the grandmother had not exhausted her administrative remedies; specifically, she had not sought a zoning variance from East Cleveland's Board of Building Code Appeals.

Another dissenter, Justice Byron R. White, said the key test was whether the ordinance denied her due process of law. He said it didn't because she and her grandchildren could have moved elsewhere in the Cleveland metropolitan area.

In a third dissent, Justive Potter Stewart, joined by Justive William H. Rehnquist, said the 1974 decision entitled East Cleveland to define "family" as it did.

The court took other actions: Mississippi Apportionment

For 12 years, the constitutional validity of plans to apportion the Mississippi House and Senate to end discrimination against blacks has been litigated in the federal courts.

Yesterday, the Supreme Court ruled 8 to 0 that a plan devised by a panel of three federal judges fails to meet "the basic one-person, one-vote requirements" imposed by the consitutional guarantee of equal protection of the laws, because the plan does not provide legislative districts of nearly equal population.

In an opinion by Justice Potter Stewart, the court ordered the panel to devise an acceptable plan "so that the citizens of Mississippi at long last will be enabled to elect a legislature that properly represents them." Police "Frisks"

Shortly after midnight: on Sept. 13, 1970, New York City Housing Authority Policeman jesse Carter, returning from a movie in his own ear, saw two men "crouched" behind a car in a partly deserted parking lot. He pulled into the lot, turned off his lights, watched for a "brief moment," and then saw one of the men holding an object in upraised hands while the other was putting an object into a back pocket.

Carter turned the lights back on, drove toward the men, stopped, got out - pistol in hand - and said. "Freeze - police officer." The hitherto unidentified objects proved to be handguns. One dropped by a man later identified as Robert Earl was a loaded 38-cal. revolver.

Earl was convicted of possession of a dangerous weapon despite his motion to suppress the evidence - the loaded 38. A divided New York Court of Appeals reversed the decision on the ground that Carter's search was unconstitutional: he hadn't known what the object was.

Yesterday, the Supreme Court; without comment, denied the state's petition for review. Chief Justice Warren E. Burger and Justices Harry A. Blackmun and William H. Rehnquist dissented.

The appellate court, they wrote, puts a policeman "in Carter's position to a difficult choice indeed. He must either ignore what he sees and what his training and experience tell him he should investigate, thereby permitting the possible completion of criminal conduct for which the suspects may be preparing, or he may approach the suspect without preparing for the very danger whichmaterialized here, thereby risking his life."