First, a slight correction: earthquakes aren't normally considered to be the cause of mountain formation; rather, earthquakes and the growth of mountains are both caused by crustal movements. Movements of crust are generally the result of plate motions, the main causes of which I will not go into here.
Now to your question. First, there is more than one kind of mountain. Some form from the addition of new magma from the mantle (examples: Hawaii, the Cascade and Aleutian volcanic arcs). Others form when a continent is pulled apart (it "rifts") and the continental edges rise up for a few million years before ultimately subsiding (example: East African rift system). Still others form from the convergence of plates and the crumpling and thickening of the plate edge(s) (examples: Himalayas, Rocky Mountains).
In the first type, earthquakes will tend to stop once magmatism stops, although in volcanic arcs deep earthquakes are related to subduction of one plate below another and related earthquakes will continue until plate convergence ceases in that area. In the second, rift-related earthquakes will become less frequent and will eventually stop as the rift either stagnates or progresses to form an ocean basin. In the third, the earthquakes will continue as long as crust in the area is thickening, usually through folding and faulting of rock layers. Where plate convergence/collision ceases, folding, faulting and earthquakes will tend to cease, although mountain belts are quite unstable after they form and may undergo faulting (and earthquakes) long after mountain building is over, as the mountainous area tries to spread out and become thin again. Thus, old mountain belts such as those along eastern North America are relatively free of earthquakes because they were built and stabilized tens to hundreds of millions of years ago. Younger mountain belts such as the Saint Elias range in southeastern Alaska and adjacent parts of Canada, are still being formed and are still rising, and are riddled with earthquakes. Mountains intermediate in age, such as the Rockies, tend not to have many earthquakes because they are quite old -- but earthquakes still occur in some places such as in the Mackenzie Mountains of northwestern Canada because of lingering activity.
As a mountain belt such as the Rockies or Himalayas forms, it absorbs the forces of plate convergence. Sometimes the plates jam up and convergence stops, ending mountain building (but leaving a welt that will tend to thin itself through extensional faulting). In other places, the piling up of rock to form a mountain belt shifts from one place to another, leaving the older parts of the mountain system less active, tectonically and seismically. In such cases, the growth of a mountain may result in less seismic activity, which may become focused in areas that are less built up and therefore more able to absorb the force of collision.
making a small donation to science.ca.