It appears that the convert_urls_into_links() function is converting URLs that are inside image tags. For instance, it converts this:
<img src="http://moodle.org/logo/logo-240x60.gif" />
<img src="<a href="http://moodle.org/logo/logo-240x60.gif" target="_blank">http://moodle.org/logo/logo-240x60.gif</a>" />
I can confirm that it is the convert_urls_into_links() function that's causing this by commenting out line ~2246 of lib/weblib.php that reads:
With that line commented out, the images display as expected with the correct HTML.
P.S. I'm assuming this has to do with the changes made in
MDL-20826, but I wasn't sure whether or not I should create a new issue since that one is "Resolved."