IIRC, the ban was an executive order, and applied as a bright line prohibition on US action against officials of foreign governments. I’ll do some digging to see which president instituted it.
It became a law, my guess it was Ford who issued the executive order, in 1975. In fact, if a US Citizen were to assassinate a foreign leader, he or she would be death penalty eligible in the US.