Will all the heirs to the Mellon fortune now stay in Virginia? Will the Rockefellers, Vanderbilts, or any of America's other fabled families now move en masse to Virginia?

The Virginia General Assembly apparently hopes so.

In the name of family unity, more taxes, and more millionaires, the recently-concluded session of the Virginia legislature passed a little-noticed bill designed to give the rich a tax break for moving into the state.

Virginia, it seems, has been one of a handful of states to place inheritance taxes on the recipients of certain forms of trusts long established by wealthy families to avoid U.S. inheritance taxes.

The trouble is, the legislature was told, that this is having a divisive impact on the family life of the very rich in Virginia. Alexandria lawyer Thomas Mays told a legislative committee that he knew of a family that had split up over the issue, with one of the heirs to a family fortune moving to, of all places, Maryland, to avoid the Virginia tax.

That was enough reason for some legislators to vote for the bill and it passed both houses of the legislature by lopsided margins. The bill needs only Gov. Mills E. Godwin's signature to become law and state Sen. Elmon T. Gray (D.Sussex), who sponsored the measure, said yesterday he expects Godwin to sign the bill.

Virginia inheritance tax officials have said the loss of inheritance taxes on recipients of the so-called "special powers of appointment" will be "minimal." Gray, himself a wealthy lumberman, said the state will more than recoup that loss by taxing the incomes of the heirs of wealthy families who now may remain in the state because of the pending change in the tax law.

In addition, he and Mays argued that the change would encourage some wealthy families to move into and remain in the state. Both said yesterday it is still too early to judge what impact the law might have.

The bill would prevent the taxation of income inherited from trusts set up under a legal device called the "special power of appointment" provision recipients of trusts have the power to appoint subsequent beneficiaries of the trust.

Under the bill, money put into this kind of a trust would be taxed only once, when the creator of the trust dies. Currently, it also is taxed when subsequent beneficiaries die.

Mays, who had told a legislative committee he knew of a situation in Northern Virginia to which the proposed law would apply, said yesterday the bill was not drawn to benefit "any particular" family and said there were hundreds of families that ultimately would gain by the change.

Many wealthy families have moved into the state unaware of what Mays called "this little ambush" that subjects recipients of trusts to a tax imposed by only "four or five" other states. The U.S. government does not currently tax the recipients of such trusts, although both the federal government and Virginia do currently tax the creators of such trusts when they die, lawyers said.