An often asked question is does writing pay, a simple answer is Fanfiction pays. I know that because a friend of mine made over twenty times what I did last year writing it. Original ideas do not (!) pay, as I found to my cost with Chronicles of Mark Johnson.
Plagiarism is briefly defined as passing another writer's ideas of as your own. There are ways around this dilemma.
Before I go further, let it be said I am not (!) in favour of it, but if anybody wishes to copy and sell Chronicles-feel free and I wish you more luck than I had-the few readers of the series will know it is not my writing style.
Some people would say if a writer agrees to you using their work, then you are not doing wrong. I don't see it that way, you are using their characters and settings, so, isn't that cheating and showing your lack of imagination.
The best scenario here is you are expanding their world not creating one of your own.
Other writers give permission as long as they get acknowledged as the source, again I see a lack of imagination showing through.
I did ask Jim Butcher's agent if I might be allowed to use his character in one of MY stories and got a less than polite NO.
It is different if as Leigh Gemmell did for her late husband David, and you re-write a story using the other writer's style. In this case, she was writing his story and not using his characters in one of her own.