There's no contradiction between the propositions that (0) the source code of an algorithm is protected speech; and (1) there's specific ways of executing that code, effecting real-world consequences, that would be against the law.
An algorithm is uncopyrightable, as it is not a creative expression. Only creative expressions are copyrightable.