What can happen if someone acknowledges a grant on papers not related to that grant? When I was preparing the camera-ready version of a paper, one of my co-author asked me to put in the acknowledgements section that his research was funded by the grant N12345.

Just out of curiosity, I searched the grant number, and found its description: "applying technique X on problem A".

I was very surprised, because my paper is completely unrelated to either X or A. Moreover, I know very well that this co-author has very little background in both X and A, let alone doing research. Although he is a very good researcher, these just are not his expertise.

The grant is for 3 years, and it is going to expire in a couple of months. He has not published any paper related to A or X. However, he has published many papers in completely different topics, e.g. the paper with me, and claimed that they were supported by this grant.

Is it the way to do if your field of research has limited funding? Might he go into troubles if it is discovered by the funding agency that the papers are actually not related to the grant proposal?
The big underlying question here is what it means for a paper to be "related to a grant". Different funding agencies have different rules on this, either a more "staff-oriented view" or a more "topic-oriented view".


Many pure science funds, for instance the Swiss National Science Foundation, take a liberal stance on what kind of science can be enabled through each individual project. Essentially, while a project is given to support a specific idea, they are fully aware and quite happy that in addition to, and sometimes instead of, this project, other more or less related studies will also happen by the staff paid partly or in full through the project. At the end of the day, the SNF and other similar agencies care not so much about the specific piece of science that is described in the project, but that some valuable science is happening and that PhD students are graduating. Based on this view, researchers funded through SNF are expected to acknowledge them on every paper they do, no matter if it has to do with any of the science described in the project description. The collection of all papers acknowledging this project is then  not understood as "all papers on topic X", but rather "all topics enabled by funding project Y, on topic X and any side projects that the funded students did in addition or instead".
Other, especially more applied funds such as most of the European Commission's Horizon 2020 programme, are much more interested in specific topics than in funding just about any research. For them, acknowledgements have much more the meaning that you seem to imply, that is, that citing this project in the acknowledgements of the paper implies that this contributes to the mission of the project. How strongly this is enforced or checked depends on the project officer. Most people also seem to take a rather liberal approach in practice, but there are certainly project officers that have formally complained about projects using the allocated funds to sponsor other research.



  Might he go into troubles if it is discovered by the funding agency that the papers are actually not related to the grant proposal?


So at the end of the day, it really depends on whether the agency actually considers this "topically unrelated but financially enabled by the grant" paper as "unrelated". I would say, in absence of any other information, you can safely assume that your co-author did nothing wrong, and that the agency may be fine with this acknowledgement.