Massachusetts received more than $3.2 billion in grants in fiscal 2022, the third-highest amount of any state in the country.