In the Mishnneh Torah, Issurei Biah 1:13 there is a law that does not punish a man who has had forbidden sexual relations with a girl who is under three years of age:
"כָּל אִשָּׁה אֲסוּרָה מֵאֵלּוּ אִם הָיְתָה בַּת שָׁלֹשׁ שָׁנִים וְיוֹם אֶחָד וָמַעְלָה גָּדוֹל הַבָּא עָלֶיהָ חַיָּב מִיתָה אוֹ כָּרֵת אוֹ מַלְקוֹת וְהִיא פְּטוּרָה מִכְּלוּם אֶלָּא אִם כֵּן הָיְתָה גְּדוֹלָה. וְאִם הָיְתָה פְּחוּתָה מִזֶּה הֲרֵי שְׁנֵיהֶן פְּטוּרִין שֶׁאֵין בִּיאָתָהּ בִּיאָה"
"When an adult male enters into relations with any of the women forbidden in connection with the above transgressions who is three years and one day old or more, he is liable for execution, kerait, or lashes and she is not liable unless she is past majority. If she is younger than this, both participants are not liable, for the act is not considered as sexual relations" (Translated by Rabbi Eliyahu Touger, Moznaim, New York 1994, p. 20).
Where did Maimonides learn this law from?