Particularly good codices include the Necron Codex, the current Space Marine codex, the current Tyranid Codex (I believe the last written by Andy Chambers, the second truly great evil 40k mastermind after Rick Priestly) the first true Chaos Codex (again, by Andy Chambers) and the first Tau Codex.
There are a few poor ones too - the Dark Eldar Codex is very very light on background, I don't rate the current Tau codex as much as the last one, and the current Chaos Demon codex for 40k feels weak also.
If you genuinely want really good background on 40k and are on an ebay spree, I'd suggest:-
1. The original rogue trader book from waaaaay back in 1987
2. Realm of Chaos Lost and the Damned or Realm of Chaos Slaves to Darkness, from circa 1987-90
3. The current 40k rulebook (not to everyone's tastes, but still good stuff)
4. The 2nd edition 40k background booklet (came as part of a boxed set, so could be cheaper on ebay than many of the others listed here, and is full of stuff not seen often since in 40k)
5. Sisters of Battle Codex
6. Xenology
7. Any of the Imperial Armour books produced by Forge World: The Taros campaign is good, the Siege of Vraks is excellent, and Aeronautica Imperialis book II is a really nice overview of an Imperial military campaign.
8. Early 40k White Dwarf articles, circa issues 99-120, many of which contain detailed background on the setting written by Rick Priestly, which are all excellent.
9. The Imperial Infantryman's uplifting primer - not essential, but fun, and the only book here to be namechecked as the basic kit of a player character in the DH system!
10. The old Epic scale 40k system background books (the adeptus titanicus rulebook, the space marine boxed set rulebook, the army lists for 40k imperial guard, squats, tyranids etc)
11. Necromunda, the collected book
12. Battlefleet Gothic and Battlefleet gothic:armada
Anyway, that'll probably cost you a couple of hundred dollars at least...to start with! Good luck!
They felt that a 40k RPG would distract potential buyers from the minis.