This has been the case since the new code search replaced the old one ~9 months ago. The new code search is more resource intensive so Github chose to only make it available to users. I agree that it sucks to not have code search available when logged out, but it's not a new change and I don't think it was done with malicious intent.
How does that work? You don't want to sign in to the site so now you will replace it with another site. Presumably you don't want to sign in to that other site as well, so what are you using the service for in the first place?
I was very unhappy when they did this. The new search btw is shittier than the old one and this was a classic case of breaking the rule of "If ain't broke, don't fix it".