Congress gave final approval to the Inflation Reduction Act, which will lower the cost of prescription drugs, extend health care subsidies and invest billions into climate and energy programs.