I somehow understand that non-native could (mis)interpret the phrase 好きなだけ
as "only things I like", which is not the actual meaning.
食べたいものを好きなだけ食べる
For the first sentence, the actual meaning is "to eat as much food as [I] want to eat".
In particular, 好きなだけ
refers to "as much as one like" and doesn't mean "only things I like". The latter may be translated from other similar sentence i.e. 好きな物だけ食べる that is more certain to mean a noun rather than an adjective/adverb in the former.
Then, the complete sentence shall be parsed as below.
糖尿病の人は美味しい食品があったとしても、制限があるため食べたいものを好きなだけ食べることができない。
For diabetic patients, even delicious food is made available, [the patients] cannot eat as much as [they] want (like) because of the [diabetic diet] restriction.