So I already witness the solution. It is this: Assume $I \not\subset P$, then there is $i \not\in P$. Then the product $ij \in IJ \subset P$, but since $P$ is prime, $i \in P$ or $j \in P$, so $J \subset P$.
here is what I don't get. Doesn't this only show a finite truncation belongs to $P$? Don't we have to show that for any finite sum $i_1j_1 + \dots + i_nj_n \in P$, $i_n \in P$ for every $n$ (assuming $|J| = |I| = n$ for ease of argument)
Well, suppose $I\not\subset P$. Then there is $i\in I$ such that $i\not\in P$. For EACH $j\in J$, $ij\in IJ\subseteq P$ by hypothesis. But $P$ is prime and so $j\in P$. Hence $J\subseteq P$.