Why is it illegal to hide a fugitive but it's completely legal for lawyers to defend people that they know is guilty?

If it's not worse, isn't defending a fugitive and hiding one basically the same thing, lawyers also do it for money which only seems worse than doing it for free, I get if the person is innocent and they need defending but even if you are guilty and they know it, they still try to defend you 😂
Why is it illegal to hide a fugitive but it's completely legal for lawyers to defend people that they know is guilty?
Post Opinion