You can be a programmer without being an engineer. But there are thousands of electrical engineers, mechanical engineers, chemical engineers, computer engineers, and others who have degrees that say "engineer" and use engineering practices who are absolutely real engineers, if not Professional Engineers.
> Engineers, as practitioners of engineering, are professionals who invent, design, analyze, build, and test machines, systems, structures and materials to fulfill objectives and requirements while considering the limitations imposed by practicality, regulation, safety, and cost
This fits a lot of software development (esp. "systems"). The process of developing software is an engineering process, not a mathematical or design process, so it makes sense to use the term "engineer". However, I wouldn't use the term for all programmers, as not all programming does the full process.
In any case, the term "engineer" is very vague and has broadened significantly over time, whereas terms like lawyer and physician have stayed pretty consistent.
The words engineer and engineering connote high intellect, professionalism and most importantly "gravitas". So, it's not a surprise that software developers/coders/programmers (usually a snubbed crowd) love being called engineers.