Congress has passed legislation to US President Barack Obama that would crack down on bots that buy batches of tickets online before humans.
Such software sometimes means that concert and theatre tickets sell out in minutes.
Using these programs is an “unfair and deceptive practice”, the legislation says.
It was approved by the House of Representatives on Wednesday and passed by the Senate last month.
Should the president sign the legislation into law, the Federal Trade Commission (FTC) would be able to crack down on those who use such programs.
The producer of the Hamilton musical, currently a hit on Broadway, testified at a Senate hearing about the bill in September.
He said some tickets were selling for more than $1,000 (£780) because so many were being snapped up automatically.
This followed a New York Times article in June, in which the musical’s creator, Lin-Manuel Miranda, wrote: “Brokers use bots to connect at lightning speed and gobble up as many hot tickets as possible, then offer them on legal resale sites like StubHub.”
Such bots were made illegal in New York earlier this year.
“Brokers armed with illegal, high-speed ticket-buying bots have kept too many New Yorkers from attending the shows, sporting events, and cultural experiences,” said New York attorney general Eric Schneiderman last month, when the legislation was passed in the state.