I am with Knuth on this one: software is mathematics and mathematics can not be patented, period. The Wiles 1985 result is definitely non-obvious to experts in the field but not patented.
IBM had, and I believe still has, disclosure journals in which they describe things they do not think worth patenting so nobody else can patent them. Some of the things published in those journals were worth $$$$$$ for both IBM and others a few years later. Maybe we could develop open source versions of these.
The purpose of patents was not promote useful arts by making inventing profitable: if any portion of the patent system is not doing that then something needs to be done. I think this approach would make more progress than any amount of idealism.
Note that can *not* sue someone for copyright infringement if they copy your drug and sell for a lot less because you spent the $$$$$$$$ to develop and get the drug on the market for them. You *can* sue then for infringing your patent on the compound.