A Federal agency receiving royalties or other payments as a result of invention management services performed for another Federal agency or laboratory under
section 207 of title 35, may retain such royalties or payments to the extent required to offset payments to inventors under clause (i) of paragraph (1)(A), costs and expenses incurred under clause (iv) of paragraph (1)(B), and the cost of foreign patenting and maintenance for any invention of the other agency. All royalties and other payments remaining after offsetting the payments to inventors, costs, and expenses described in the preceding sentence shall be transferred to the agency for which the services were performed, for distribution in accordance with paragraph (1)(B).