We would use "it earned" to refer to a specific day. For example, "on Thursday, it earned $2 million". By using "by + time marker" (in this case, "by the end of the week"), the past perfect is appropriate. There is still an opportunity for it to earn more.
I am on a diet. By last weekend, I had lost six pounds.
I am trying to make £100. By last Thursday, I had made £20 but there was a real boost on Friday when I made £85 so, by Friday evening, I had made £105!
Student or Learner