That would depend on if the distribution was made within 90 days of electing to participate in making contributions.
Additionally, paying education expenses can waive the penalty tax on a distribution from an IRA but not from a 401(k).
**Say "Thanks" by clicking the thumb icon in a post
**Mark the post that answers your question by clicking on "Mark as Best Answer"