4mA to 20mA transmitter design question
The circuit goal is to have a good replica of the input current, from Vin-R1, flow through IP2. The replica is then amplified and sent to the next device in the chain.

To have a good replica of the current, you need to shine light on IP2 through the LED inside the IL300, but of course you need to shine just the right amount of light. To do so, you should know K2 down to a very high precision, but unfortunately in microelectronics having a value be very near something is difficult. What we are good at doing is matching values, so the manufacturer guarantees that K1 and K2 are very well matched, but their absolute value can vary quite a lot.

So you know that to have a replica in IP2, you should shine on it the same light that produces a good replica on IP1, because K1 = K2.

You achieve this by having the input current flowing into IP1, and then having a negative feedback ckt that feeds the diode with just the right amount of current in order to have the right current flowing into IP1.

How does this happen? Assume that Vin goes up a tiny bit, then the voltage on the inverting input of U1 goes up the same tiny bit, because IP1 cannot change since the light has not changed.

The opamp now sees a more negative voltage, thus it absorbs more current. That current is amplified by the transistor, and more current flows into the LED. More current in the LED means more light means more current in IP1 means more drop in R1 means that the negative input goes back to zero, and the opamp is happy and doing its job.

The output current of the opamp is thus very similar to the input current, because the circuit is built in the way it is built. The gain of the transistor is ~100, while the gain of the optocoupler is ~1/100, so this can lead you to think that the two currents are the same. They are not, they are incidentally very similar in amplitude, but if you change the K1 of the model of the IL300, you will see that the current will change in amplitude.

The shape of the currents are very similar because the transistor that amplifies, and the IL300, are pretty linear. If you had non linearities, you would see a very different current, just the right current to compensate for all the ckt non linearities.