A Cedar Rapids man who used his girlfriend to illegally buy guns for himself and other people was sentenced to over 21 years in federal prison.