The deal comes after months of wrangling between the White House and lawmakers over how large an infrastructure package should be and how to pay for it.