The USA has many of its largest cities right on the East Coast. However, Canadian cities in New Brunswick, PEI, and Nova Scotia are on the smaller side, with the larger cities up the Saint Lawrence. Why this difference? Does the advantage of the river outweigh the advantage of being on the ocean?
Geography teachers used to teach the concept of the fall line when talking about the East Coast of the US.
It's common for cities to arise at the head of navigation, the most inland place that oceangoing ships can reach, as rivers are harbors protected from ocean storms. In North America, where settlement coincided with the Industrial Revolution, the fall line was also a natural place to set up industry, such as mills run by water power. That brings together several of the elements that grow a city: a harbor, industry, and the place where goods must be shifted from one mode of transport to another. A mere ocean harbor is not very useful unless exports can be easily collected there, via an inland river network, and imported goods can be distributed via the same network. In the 19th century, railroads and wagon roads allowed such entrepôts to develop at harbors that weren't reached by river networks.
The fall line cities of the American colonies include Philadelphia, Wilmington, Baltimore, Richmond, Raleigh, and Columbia, S.C. Montréal is where the Lachine Rapids prevent further navigation up the St. Lawrence—and also provide power for grain milling. There are other important factors as well, including political factors and the dominance of fishing in the rocky Maritimes compared to more suitable conditions for agriculture in Québec and Ontario.
When New France was founded, its early value was in the fur trapping business. As such, control of the St. Lawrence River became very important. From the St. Lawrence River, you could navigate down to Lake Ontario and from there, you could reach all the other Great Lakes. And by sailing around Michigan, you could get to Chicago, the best place to "portage" from the Great Lakes to the Mississippi River. This is why Chicago is where it is. (See: Chicago Portage).
Not only that, but from the St. Lawrence River, you could also "portage" down to parts of the East Coast as well. From the St. Lawrence, you could sail down to Lake Ontario, then south to the Oswego River, which leads to Oneida Lake in New York. At the Oneida Carry, you could then portage four miles from Oneida Lake to the Mohawk River, which leads to the Hudson River, and would take you right to New York City.
And from there, there was a longer overland route of about 50 miles from the Raritan River near modern day New Brunswick, New Jersey, down to Trenton, and from there you could sail down the Delaware River to Back Creek, which would hook you up to the Chesapeake Bay going south, giving you access to Baltimore and Virginia, or else to the Susquehannah River going north, giving you access to the interior of Pennsylvania.
In other words, the St. Lawrence River and the Hudson River were the two most important rivers in early America, because if you controlled those, you controlled all the important sailing routes between the Mississippi River and the East Coast, and from Virginia to all points north. So it's no wonder that the French, the English, and the Dutch spent a lot of the 1600s and early 1700s fighting for control over those two rivers.
Thus, it was important for France to establish a military presence and ultimately a colonial presence along the St. Lawrence River, to give France access to the most important waterways in the North American fur trapping industry. Hence, Montreal and Quebec became two of New France's earliest settlements, both established before 1650.
The coastal region of present day Canada was also important, but the reason it did not produce a major settlement like Montreal and Quebec was that both England and France claimed the land. France established it as the colony of Acadia before 1700, and established a military presence there as early as 1605 on Port Royal, in Nova Scotia.
But the Scottish and eventually the English, too (and then, ultimately, the British) were using Nova Scotia and the other maritime provinces as a seasonal fishing colony. This led to many skirmishes between the French and the English/British over Acadia. France was the dominant European force in the area for most of 1600s, but after the seige of Port Royal in 1710 during Queen Anne's War, the British were able to establish a military fort on Nova Scotia as well. Still, even with the British military fort, French Acadians remained living in the outlying areas.
Control of the area became a goal of both sides during the first half of the 1700s, and so it became a battlefront during the French and Indian War when it broke out in 1753. In fact, there was already a proxy war going on in Acadia before the French and Indian War broke out, which is now known as Father Le Loutre's War, a war that had been waged since 1749.
If France or England had been able to take the sole total control of Acadia earlier than that, then there likely would have been a substantial colonial settlement in the maritime provinces that rivaled Quebec and Montreal. But since France and England/Great Britain spent the 1600s and first half of the 1700s battling for control of the area, it wasn't until 1749 that a major permanent settlement was established there. That settlement was Halifax, which the British military established in order to have enough of an English-speaking presence in the area to maintain control. But major settlement wasn't really possible until hostilities in the area had died down toward the end of the French and Indian War, around the close of the 1750s.
At the end of the French and Indian War, the French-speaking population of Acadia was deported, either being resettled in the area that's now the province of Quebec, or else down in Louisiana, or else in one of France's remaining Caribbean colonies. Halifax's population was then made up primarily of 8000 planters from New England, who came because the British government gave them free land. They had been preceded by several thousand resettled British citizens as well as Swiss Germans who had come before the French had been deported. So Halifax didn't exist before 1749, and most of its first ~10,000 citizens didn't come until after the French and Indian War was over, while the original population of French Acadians--numbering around 13,000 people--were forced to leave for new homes. In total, before the deportation, that actually was pretty similar to Quebec and Montreal at the same time. In 1754, the town of Quebec had about 8000 citizens while Montreal had about 4000 citizens (1, 2), though the whole of what is now the province of Quebec had about 55,000 citizens at the time of deportation.
After that, the reason that the Canadian cities grew as they did was largely economics of new settlers and the politics of Great Britain/United Kingdom. Ontario was founded by American Loyalists who were kicked out of the Thirteen Colonies at the end of the Revolutionary War. The British government offered free land to Loyalists as payment for their war services. While many were also settled in the maritime provinces, many more were settled in Ontario, so that the British had control over a larger piece of land.
Thus, York (later renamed Toronto) became the big city that arose, as Ontario was the big destination in Canada for English speakers during the first half of the 1800s, while Montreal and Quebec grew because the province of Quebec was the place that French language immigrants would prefer. Halifax grew, too, during this period, just not as quickly as the other three did. Still, in 1871, Halifax was Canada's fourth largest city followed by St. John, New Brunswick, in fifth place.
One of the significant differences is the suitability of the land for agriculture. There is a great deal of good agricultural land in the US near the coast, whereas almost all of the good agricultural land in Canada is significantly inland (There are exceptions, like the Annapolis Valley in Nova Scotia, but it doesn't compare in size to the available agricultural land in Ontario and Quebec). The land in the St. Lawrence Valley is also flatter and much more suitable for building.