See attached picture.
H is the height of the cone; h is the height of the cylinder. R is the radius of the cone; r is the radius of the cylinder. (sorry I don't know why but I called it B and b in the diagram... just pretend B is R and b is r).
By similar triangles,
Solve for h (it will be in terms of r).
Plug this equation for h into the volume function for the cylinder ( ).
Maximise V over [0,R].