If we want to thoroughly split hairs, I suppose we could come up with a slight difference.
Any city that is built along a river can also said to be by a river.
However, not every city that is built by a river can be accurately described as being along a river.
Consider this map:
Both cities are by the river (we could also say they are on the river), but one could argue that the northern city is built along the river, while the southern city is built more near the river than along it.
However, most of time time, people won't think that much about this subtle difference. And nobody would argue that the northern city is not by the river, because clearly it is.
Also, in a practical sense, most cities probably take up enough riverfront land that it would be very hard to find an example of a city that would be considered by a river but not along the river.