There are a number of "gains" to be had from Daisy Miller dying. First, her death provides a definitive closure to James's "study" of her: we remember that the full title of the novella is Daisy Miller: A Study. Daisy is an object d'art: James has painted her portrait and now can move on without any need to follow her further.
Moving into the interior of the story, however, the "gain" of her death proves the point the story is trying to make: it is concretely dangerous to defy social norms. Flirting with Italian men on a holiday is not simply an amusing diversion, but a flirtation with disaster. Daisy's going off alone with Mr. Giovanelli is not simply a matter of an American girl being independent and free. In being too innocent to understand the implications of what she is doing, Daisy contracts a fever—the Roman fever she flippantly declares she is not afraid of—and dies, a fitting "moral" to what can be read as a cautionary tale about the importance of staying within the limits of the social code. (And if had not been a fever, it could have the scandal of a pregnancy, or a death from childbirth).
Digging a little deeper, Daisy's death is important because, knowing she is dying, Daisy comes to realize the importance of reputation. It is important to her to communicate to Winterbourne that she wasn't engaged to Giovanelli. Winterbourne has some regrets that he didn't acknowledge this before he died, but he quickly moves on to the next flirtation, also suggesting that girls like Daisy aren't that important in the grand scheme of things.