You could make that same argument about patents in general, couldn't you? If you invent something, say, a new battery, and somebody else copies it, doesn't have your R&D-costs invested and prices it accordingly lower than you, the market will "reward them" by buying from them instead of you, they're getting the same thing after all.
We do want some stability though, if you invest money to create something and somebody immediately copies it, you're not going to invest money again. We want you to invest money to advance humanity with new technology and knowledge though.
Since there's no re-implementation without looking at the original, it feels sufficiently close to taking your buddy's homework and saying "no worries, I will change it a bit" and you'll have Math.add(a, b) and while they wrote return a + b;, you'll write return b + a;, you're not copying after all.