"EU agencies are distinct bodies from the EU institutions – separate legal entities set up to perform specific tasks under EU law."
Both UK decentralised agencies hold the leases, not the EU, they are solely responsible for them.
EMA - 25 year lease with no break clause, funded 90% by commercial fees with 5% contribution from the EU and no member state contributions.
EBA - 12year lease with mid term break clause, funded 40% by the EU and 60% by the member state (shared in proportion of voting rights)
If Barnier was clever he could try again to introduce his failed EU consulates regulation - apply it to both buildings obtain ECJ jurisdiction within the building leaving them in place and saving the agencies a whole pile of money - of course that wont happen