Here the preposition "in" doesn't refer to anything and it is used because it is required as the below two sentences show:
A symbiotic relationship is an interaction between two or more species.
One species lives in or on another species in an interaction (between two or more species).
If you omit the "in" in bold, the sentence will not be grammatical. The relative pronoun "which" replaced the second "interaction" as in:
A symbiotic relationship is an interaction between two or more species which one species lives in or on another species in.
It is personal style or preference where to place the preposition "in". You can place it either before "which" as in your example or at the end of the sentence. Some style guidelines and grammar books prefer placing it before "which" and I share this preference personally. Also, unless you place "in" before "which", it could confuse readers as there is another "in" in the sentence. "In which" could be replaced by "where" which is a relative adverb as in:
A symbiotic relationship is an interaction between two or more species where one species lives in or on another species.