It could be two things:
1 - Someone got paid to put them there, a designer, a developer etc.
2 - One of the latest techniques on black hat
SEO is to hack websites and put hidden links in their source code.
Fortunately, Google and other search engines are great at detecting these automatically and these links are ignored but unfortunately the site that contains them will be penalized because it looks to Google like the site did this intentionally to make money or something.
Joomla and other open source software are vulnerable to hacking. The reason is everyone can see their source code and if there is a hole in there, hackers exploit it on websites who run the software.
It might be that their version of Joomla is old and they didn't upgrade it to the latest version and often this is the case when you find something like this has happened. New versions usually fix security issues and other bugs.
So here is the lesson from all of this:
If you use Joomla, Wordpress or any other software that is open source and free, be sure to upgrade to the latest version as soon as it's available!
I hope this helps