Generic drugmaker says it agreed to contribute sum in cash and medications to states, local governments and tribes for its role in epidemic