Miriam's Role
In order to understand the significance of Miriam's role, and her subsequent judgment, it's necessary to understand the progression of the offence. Rashi makes this comment on verse 1,
She spoke first. Therefore, Scripture mentions her first. How did she
know that Moses had separated from his wife? [See below] R. Nathan
says: Miriam was beside Zipporah when Moses was told that Eldad and
Medad were prophesying in the camp. When Zipporah heard this, she
said,“Woe to their wives if they are required to prophesy, for they
will separate from their wives just my husband separated from me.”
From this, Miriam knew [about it] and told Aaron. Now if Miriam, who
did not intend to disparage him [Moses] was punished, all the more so
someone who [intentionally] disparages his fellow. — [Tanchuma Tzav
13]
From Keil and Delizsch's Commentary of the same passage,
Miriam was the instigator of the open rebellion, as we may see both
from the fact that her name stands before that of Aaron, and also from
the use of the feminine תּדבּר in Numbers 12:1. Aaron followed her,
being no more able to resist the suggestions of his sister, than he
had formerly been to resist the desire of the people for a golden idol
(Exodus 32).
What's more, when the Lord summoned the 3 of them(Moses, Aaron, and Miriam) to the door of the Tabernacle(vs 3) He called Aaron and Miriam and said,
And he said, Hear now my words: If there be a prophet among you, I the
LORD will make myself known unto him in a vision, and will speak unto
him in a dream.
Miriam was identified as a "prophetess"(Ex. 15:20),
And Miriam the prophetess, the sister of Aaron, took a timbrel in her
hand; and all the women went out after her with timbrels and with
dances.
Consequently, the Lord's words were directed towards her,
"....If there be a prophet among you, I the LORD will make myself
known unto him in a vision, and will speak unto him in a dream.
In other words, the Lord will reveal Himself to her at the time and place of His chosing, whether it be by vision or dream. But with Moses, "...he is faithful in all My house". (From Keil and Delitzsch)
The prophets were consequently simply organs, through whom Jehovah
made known His counsel and will at certain times, and in relation to
special circumstances and features in the development of His kingdom.
It was not so with Moses. Jehovah had placed him over all His house,
had called him to be the founder and organizer of the kingdom
established in Israel through his mediatorial service, and had found
him faithful in His service. With this servant (θεράπων, lxx) of His,
He spake mouth to mouth, without a figure or figurative cloak, with
the distinctness of a human interchange of thought; so that at any
time he could inquire of God and wait for the divine reply.
Miriam's Sin and Judgment
Therefore, God was specifically rebuking Miriam, in explaining the difference between her calling and Moses's calling. The suggestion was Moses was somehow "tainted" by marrying a Cushite, and therefore not 'worthy' of the office he held; God specifically directed His rebuke towards her, reminding her of who He designates as approaching Him, and dare she presume herself to be more 'righteous' than Moses, who in the same passage was said to be,
(Now the man Moses was very meek, above all the men which were upon
the face of the earth.)(vs 3)
The judgment for her critical spirit was leprousy, which appeared on her flesh as a "whiteness", but a whiteness that is a sign of rotting flesh, the byproduct of leprousy. When was hidden in the inside became evident on the outside.
Aaron, in the passage quoted, readily recognizes Miriam's and his sin. Because he held the office of High Priest, he bore the iniquity not only of himself, but also the whole nation. Ex. 28:38 describes the the mitre on Aaron,
“And it shall be upon Aaron's forehead, that Aaron may bear the
iniquity of the holy things, which the children of Israel shall hallow
in all their holy gifts; and it shall be always upon his forehead,
that they may be accepted before the LORD.”
Aaron, by virtue of his office bore the iniquity of all; including Miriam's. In stating that Miriam's flesh is half consumed, Rashi says,
Since he [the dead one] came out of the womb of the mother of the one
who has the power to help him but does not, it is as if half his [the
latter’s] flesh is eaten away, since his brother is his own flesh.
Another interpretation: Let her not be like the dead-If You do not
heal her through prayer, who will confine her? Who will cleanse her? I
myself may not examine her, since I am related, and a relative many
not examine plague marks [symptomatic of tzara’ath], and there is no
other kohen in the world.
Aaron is readily bearing the iniquity of Miriam, and acknowledging his own in the process. It is up to Moses to petition God for mercy on Miriam's behalf; which he does and God answers, yet Miriam must go through a time of impurity, acknowledging her sin and accepting the consequences of it; though the Lord honors Moses's prayer and delivers her.
Summary
God directed His anger towards Miriam because she was taking to herself a role that wasn't hers. The same rebuke also applied to Aaron, yet it seems he already acknowledges his sin, and petitions on behalf of Miriam. Aaron, in ministering in the role of High Priest, acknowledges his and Israel's iniquities before God and consequently makes his plea to Moses, who intercedes for them. God restores both of them, and gives them an object lesson lest they forget.