"Hagrid," said Harry loudly, "give it two weeks and Norbert's going to be as long as your house. . .”
The following week dragged by. Wednesday night found Hermione and Harry sitting alone in the common room, long after everyone else had gone to bed. The clock on the wall had just chimed midnight when the portrait hole burst open. Ron appeared out of nowhere as he pulled off Harry's invisibility cloak. He had been down at Hagrid's hut, helping him feed Norbert, who was now eating dead rats by the crate.
"It bit me!" he said, showing them his hand, which was wrapped in a bloody handkerchief. "I'm not going to be able to hold a quill for a week. I tell you, that dragon's the most horrible animal I've ever met, but the way Hagrid goes on about it, you'd think it was a fluffy little bunny rabbit. When it bit me he told me off for frightening it. And when I left, he was singing it a lullaby." (Harry Potter and the Sorcerer's Stone)
It's the first meaning - but it means that Norbert was eating a lot of dead rats, rather than that he was literally eating cratefuls of them.
Since this is a fantasy novel (rather than a conversation or realistic fiction), it seems that this is being used both figuratively and possibly as a play on language and meant to be taken literally as well.
- He is eating a very large amount of rats.
- He is eating a very large amount of rats that are sold in crates.
So, I would say the answer is "A." "By" is indicating that the rats are sold in units of crates filled with them. This construction "by the ___" is common in English to indicate a large quantity. One clue that it's not "B" is that there is no other reference to a crate in the space. If he were next to a crate, it would say "... now eating dead rats by a crate." (rather than "the crate")