That's not from Middle English, it's from French.
Middle English was closer to French than modern English in many ways-English monarchs still spent time in Normandy and claimed the French crown for generations after William the Conqueror.
e.g. 孟子 1A/3 河內凶,則移其民於河東,移其粟於河內 (strongly suggesting that the current naming practices were also current 2200 years ago); 庄子 秋水 13 我知之濠上也 (ordinary positioning).
So my mother-in-law just said '上海不在海上', i.e. 海上 is closer to the literal meaning of 'on top of the ocean (physically)', which the city is not.
Perhaps 上 here acts as a verb or gerund ((going up / on the way) to the ocean)? 下海 means 'going (down) to the ocean'.
The rabbit hole here can get deep (and thanks for drawing me in!), this book [2] goes in-depth about how word class and word order influenced one another as Chinese developed.
[1] https://en.wikipedia.org/wiki/Classical_Chinese_grammar#Word...
[2] https://www.google.com/books/edition/_/r9WO6g5mqi8C?hl=en&gb...
This is possible, but I don't think it's a coincidence that the normal way to express that is 下海. The ocean is pretty much by definition both "down"stream and downhill of everything; approaching the ocean by going up is semantically unnatural. My guess above of "get onto the ocean" (i.e. "set sail") was drawing a parallel to 上路 "get on the road" / "start traveling".
> 海上 is closer to the literal meaning of 'on top of the ocean (physically)', which the city is not.
I don't see this as a huge obstacle; "upon the sea" has the same literal meaning but isn't surprising in an English place name, though "by the sea", with the correct literal meaning, isn't surprising either.
Just like [noun modifier] is no longer standard English, but we do keep phrases with that ordering from Middle English (e.g. Surgeon General)