When it comes to particles, and I am speaking in general terms here, you shouldn't try to understand or memorize them by pairing them up or finding supposed equivalents, because that never works. Cross-linguistically, there is no equivalence in particles, prepositions, adverbs. Even those grammar terms vary cross-linguistically. In case you haven't noticed, oftentimes the function of a preposition in English is fulfilled in Japanese by a particle or particles. So it is of no help or even detrimental to your study of Japanese to try and find English equivalents for the Japanese particles.
「に同じ」usually indicates something is just like another thing. It is usually a one-directional comparison. It often occurs in dictionaries. Some random examples:
There is a tongue in cheek online expression, almost memefied: 「右に同じ」 "I agree with the opinion to my right."
「と同じ」is commonly used to say two things are of the same nature or share the same attribute. The comparison is more reciprocal.
この手順は、非トランザクション志向メッセージングの場合と同じです。 (example from a random site)
And 「と同じ」is correct in the line you are asking about.