That’d be because 50 years ago, Bernie was fighting against segregation as a college student. Chaining himself to a black woman and getting arrested for it. That was back in the days when people, even white people, regularly got killed for helping black people try to achieve equality. Bernie was doing this not as a candidate for anything. He was doing it because he felt it was the right thing to do.
Regarding your quote of Bernie’s during congressional testimony, it had nothing to do with race. There are no code words there. No dog whistles. You could (and people do, and I’d bet a lot Bernie would) say the same thing today. All Bernie was saying — and if you watch the entire segment you’ll see this context — is that there are people who belong in prison. There was zero racial context.
Your entire premise that Bernie has a mixed record on race is completely unfounded as far back in the comment chain I could go on this.