The US patent system is purpose designed as a restraint of trade system. "If we didn't invent it we'll pretend we did and then you lot can't operate in our territory."
Elsewhere you can't patent software because by definition a computer program isn't an invention, however you can copyright software under certain circumstances and that's not unreasonable.