The hip-hop star — whose legal name is Rakim Mayers — risked more than 24 years in prison if he had been convicted.