A Tennessee man who became a subject of national scorn after stockpiling 17,700 bottles of hand sanitizer donated all of the supplies on Sunday just as the Tennessee attorney general’s office began investigating him for price gouging.

On Sunday morning, Matt Colvin, an Amazon seller outside Chattanooga, Tenn., helped volunteers from a local church load two-thirds of his stockpile of hand sanitizer and antibacterial wipes into a box truck for the church to distribute to people in need across Tennessee.

Officials from the Tennessee attorney general’s office on Sunday took the other third, which they plan to give to their counterparts in Kentucky for distribution. (Mr. Colvin and his brother Noah bought some of the supplies in Kentucky this month.)

The donations capped a tumultuous 24 hours for Mr. Colvin. On Saturday morning, The New York Times published an article about how he and his brother cleaned out stores of sanitizer and wipes in an attempt to profit off the public’s panic over the coronavirus pandemic. Mr. Colvin sold 300 bottles of hand sanitizer at a markup on Amazon before the company removed his listings and warned sellers they would be suspended for price gouging.