The deal includes $400,000 signing bonus and playtime incentives.
The Ravens didn't give Levine, a former undrafted free agent from Tennessee State, a restricted free agent tender and instead signed him to a longer-term contract.
Levine played in every game last season and started three times. He finished with 23 tackles and four passes defended, plus six special teams tackles.
The converted safety had a career-high 10 tackles in a loss ot the San Diego Chargers as he started at cornerback.
Levine drew interest from other NFL teams before deciding to remain with the Ravens. He had a career-high 11 special-teams tackles the previous year.