You’re mixing patent and copyright. You can patent an innovative algorithm in the US. And the implementation is of course protected by copyright