It goes at the end of the fuel rail to control the return rate of the fuel back to the tank, that's how it builds up and "regulates" the fuel pressure.
It probably has to do with pressure drop. It could "possibly" have a slight pressure drop after the regulator so all injectors wouldn't get exactly the same pressure.