Accord will result in higher medicines spending in Britain in exchange for exemption from threatened Trump tariffs