Massachusetts, Minnesota and Rhode Island are using cost analysis and data to prioritize investments before disasters strike.