  We report a solution of the inverse Lagrangian problem for the first order
Riccati differential equation by means of an analogy with the Friedmann
equation of a suitable Friedmann-Lema\^itre-Robertson-Walker universe in
general relativity. This analogous universe has fine-tuned parameters and is
unphysical, but it suggests a Lagrangian and a Hamiltonian for the Riccati
equation and for the many physical systems described by it.
