A judge told Daniel Thompson, 28, and Idris Akinwunmi, 21, they were part of a hacking culture which undermined public trust in online security.
Aston University student Akinwunmi, transferred just £13 into his account during the attack on National-Lottery.co.uk in November 2016.
The pair had previously admitted offences relating to the incident.
Thompson pled guilty to three cyber crime offences, while Akinwunmi, admitted a hacking offence and fraudulently transferring the money to his account.
At Birmingham Crown Court on Friday, Judge Kristina Montogmery QC said they were two of “thousands involved in the cyber attack”.
Camelot spent at least £200,000 investigating, and tightening up security after the incident, while 254 compromised National Lottery player accounts had to be closed.
The hacking programme Sentry MBA was used to retrieve username and password combinations, which were sold on or supplied to hackers
Thompson played a game on the lottery website to the tune of £2-£3, but made no other financial gain.
National Crime Agency (NCA) officers traced the activity to the home he shares with his mother in Millfield Avenue, Newcastle.
A version of the programme on his computer been used to hack sites and accounts more than 400 times, including the National Lottery, Tesco.com, Points to Shop, and Mindspay.
The judge said Akinwunmi, of Kingston Road, Birmingham, had watched hacking tutorials on YouTube, using details provided by another hacker to access a user’s account.
He then “shared the methodology” with others and was traced after using a university computer to carry out the hack.
Thompson was jailed for eight months and Akinwunmi for four months.