The situation between James Bond and Harry Potter movies are different.
Harry Potter movies are produced by WB which is an American company. JK Rowling sold conditional movie rights to Harry Potter to WB.
James Bond movies are not produced by American studios. They are produced by Eon Productions which is a British company and is distributed by American studios. It's kind of like how the first three Superman movies were produced by the Salkinds (who owned the film rights to Superman at the time) and were only distributed by WB.
Eon Productions get millions of pounds in tax credits from the UK for that reason. It's a complicated arrangement with Bond but the long and short of it is the producers and distributors of the movies make most of their bank outside the US.