Generally correct. With respect to funds attributable to contributions made directly to the 457(b) plan, a distribution that you receive from a 457(b) plan before age 59½ will have code 2 in box 7 to indicate that the distribution is not subject to an early-distribution penalty.
However, funds that you roll over to a 457(b) plan from a non-457(b) plan and any gains attributable to those funds are required to be tracked separately by the plan administrator and any distribution of these particular funds prior to age 59½ is subject to an early-distribution penalty.
Any distribution after ate 59½ will have code 7 in box 7 to indicate that the distribution is not subject to an early-distribution penalty.