The prime contractor hired to build Maryland’s flawed online health exchange will pay $45 million to the state and federal governments to avoid a lawsuit over its performance, Attorney General Brian Frosh announced Tuesday.