Lottery fever has gripped the US as a draw took place for a $640m (£400m) Mega Millions prize, the biggest jackpot in world history.

The numbers drawn on Friday night were 2, 4, 23, 38, 46, Mega Ball 23.

Forty-two states took part in the draw. US officials said one of the winning tickets was bought in Maryland, and that there could be other winners.

Earlier, queues snaked out of shops from coast to coast with some punters snapping up tickets by the bushel.

The prize money has been swelling since 24 January, with no winner matching all five numbers in the last 18 draws.

The prize had stood at $540m before Friday's announcement. Lottery officials earlier estimated that customers would have spent some $1.5bn on tickets by the time of the draw.

Winning numbers 2, 4, 23, 38, 46

Mega Ball 23

A jackpot winner could choose between receiving the full amount of $640m in 26 annual payments (more than $24m a year) or an instant cash option of more than $460m.

'Ticket-buying frenzy'

The largest jackpot to be paid out until now was a $390m Mega Millions prize that was split between two winners in 2007.

One hopeful ticket-buyer, Allsaints Macauley, a 64-year-old taxi driver in Washington DC, told the BBC that if he won he would drive his vehicle to one of the capital's busiest intersections and leave it behind to be towed away.

"I'd skip town with my children to a place where the temperature will not go below 86 [F] and just hang out.

How to spend your jackpot Try to stay anonymous. If your identity gets out, it can be hard to escape the attention - and those who want some of your fortune.

Take the money over time - 98% of jackpot winners choose instant payout options, but most people run through that money in five years or less. You can make better use of the money, and plan better, by taking the prize in annual installments. It can sometimes also be better from a tax perspective to receive the prize over time.

Find a financial adviser, or ideally a set of advisers, who have experience working with assets as valuable as your prize. Many winners ask their friends or people they know to help them manage their money, but they are not equipped to help you make the best decisions.

Use some, or preferably most of the money to give back to society. The happiest winners are usually the ones who used their money for public good.

"The guys on Wall Street invest my trust, so my kids will never have to drive a cab or wash dishes like I did."

Also in the queue was Mike Notarangelo, 52, unemployed, who said: "I'd set up my daughter, take care of my parents, and choose some charities to get some of the money.

"After that, I would travel the world. See all those places I've never been to."

In California, some shops have been experiencing a ticket-buying frenzy, after lottery officials in the Golden State revealed which outlets have previously sold the most winning tickets.

Ryan King, a 33-year-old construction worker,told the Los Angeles Times: "I've already spent the money in my head, 300 times."

The Las Vegas Sun reportsthat people have been driving to a shop on Nevada's border with California to buy tickets.

Some $2,600 of tickets were sold to one buyer at a cafe in the state of Arizona, reports the Associated Press.

Even the relatively wealthy have apparently not been immune to the lottery bug.

NBA basketball player Chris Singleton, who earns a reported $1.5m playing for the Washington Wizards,said on Twitterthat he planned to splurge $10,000 on tickets.

You are about 50 times as likely to get struck by lightning as to win the lottery Mike Catalano, Mathematics professor

The Kansas City Starthat the winnings could buy a Boeing 787 Dreamliner, a private island near Phuket, Thailand, or a fleet of 200 Bugatti sports cars.

But the odds are stacked overwhelmingly against any one person matching the six-ball jackpot.

Lottery officials say the chance of winning is just one-in-176 million. Tickets cost $1.

Mathematics professor Mike Catalano of Dakota Wesleyan University told the Associated Press news agency: "You are about 50 times as likely to get struck by lightning as to win the lottery, based on the 90 people a year getting struck by lightning."

Based on other US averages, a person is 8,000 times more likely to be murdered, or 20,000 times more likely to die in a car accident than to win the lottery, he added.

The states of Florida, Alabama, Mississippi, Alaska, Hawaii, Wyoming, Utah and Nevada are not participating in the draw.